# R program to illustrate # the use of cumprod() Function# Calling cumprod() Function
cumprod(1:4)
cumprod(-1:-6)
R
输出
[1]12624[1]-12-624-120720
R
例2 :
# R program to illustrate # the use of cumprod() Function# Creating Vectors
x1 <- c(2,4,5,7)
x2 <- c(2.4,5.6,3.4)# Calling cumprod() Function
cumprod(x1)
cumprod(x2)