Calculate Cumulative Product of a Numeric Object in R Programming – cumprod() Function Last Updated : 05 Jun, 2020 Improve Improve Like Article Like Save Share Report cumprod() function in R Language is used to calculate the cumulative product of the vector passed as argument. Syntax: cumprod(x) Parameters: x: Numeric Object Example 1: # R program to illustrate # the use of cumprod() Function # Calling cumprod() Function cumprod(1:4) cumprod(-1:-6) Output: [1] 1 2 6 24 [1] -1 2 -6 24 -120 720 Example 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) Output: [1] 2 8 40 280 [1] 2.400 13.440 45.696 Like Article Suggest improvement Previous Compute the Correlation Coefficient Value between Two Vectors in R Programming - cor() Function Next Count the Frequency of elements in a Numeric Vector - tabulate() Function Share your thoughts in the comments Add Your Comment Please Login to comment...