x <- 1:10
cumsum(x)
b
On Nov 7, 2007, at 5:59 PM, Alexy Khrabrov wrote:
> I need a vector with sums of vectors up to each position in the
> original. The imperative version is simple:
>
> # running sum: the traditional imperative way
> sumr.1 <- function(x) {
> s <- c()
> ss <- 0
> for (i
Alexy Khrabrov wrote:
> I need a vector with sums of vectors up to each position in the
> original. The imperative version is simple:
>
> # running sum: the traditional imperative way
> sumr.1 <- function(x) {
>s <- c()
>ss <- 0
>for (i in 1:length(x)) {
> ss <- ss + x[i]
>
2 matches
Mail list logo