Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 205399

R: fastest way to calculate sum over vector? [closed]

$
0
0

Let k and j be vectors.

I need to calculate the value sum(f(j) g(k[i])) for every i = 1, ..., length(k) for two functions g and f (that are vectorized).

So, in other words, the sum is over each element in j and I need to calculate that sum for every element in k, so that I end up with length(k) different sums.

What is the fastest way to do this in R?


Viewing all articles
Browse latest Browse all 205399

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>