How to write dynamic cumulative multiple in R -


suppose have vector x as:

x <- c(x1, x2, x3, ..., xn) 

i want write function automatically result series this:

y <- c(x1, x1*x2, x1*x2*x3, ..., x1*x2*x3*...*xn) 

can tell me how in r?

have @ ?cumprod:

 cumprod(1:10)  # [1]       1       2       6      24     120     720    5040   40320  362880 3628800 

Comments

Popular posts from this blog

vb.net - Alternative to the T-SQL AS keyword -

php - MySQLi binding parameters in a prepared statement doesn't work unless inserted after "WHERE" -

ios - CFRelease causing crash in iPad application -