Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Data Visualization
  • Statistics in R
  • Machine Learning in R
  • Data Science in R
  • Packages in R
  • Data Types
  • String
  • Array
  • Vector
  • Lists
  • Matrices
  • Oops in R
Open In App
Next Article:
Calculate the cross-product of a Matrix in R Programming - crossprod() Function
Next article icon

Calculate Cumulative Product of a Numeric Object in R Programming – cumprod() Function

Last Updated : 05 Jun, 2020
Comments
Improve
Suggest changes
Like Article
Like
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: Python3 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: Python3 1==
# 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  

Next Article
Calculate the cross-product of a Matrix in R Programming - crossprod() Function

N

nidhi_biet
Improve
Article Tags :
  • R Language
  • R DataFrame-Function
  • R Math-Function
  • R Vector-Function
  • R Matrix-Function

Similar Reads

  • Calculate Cumulative Sum of a Numeric Object in R Programming - cumsum() Function
    The cumulative sum can be defined as the sum of a set of numbers as the sum value grows with the sequence of numbers. cumsum() function in R Language is used to calculate the cumulative sum of the vector passed as argument. Syntax: cumsum(x)  Parameters:  x: Numeric Object Example 1:  [GFGTABS] Pyth
    1 min read
  • Calculate the cross-product of a Matrix in R Programming - crossprod() Function
    crossprod() function in R Language is used to return the cross-product of the specified matrix. Syntax: crossprod(x) Parameters: x: numeric matrix Example 1: # R program to illustrate # crossprod function # Initializing a matrix with # 2 rows and 2 columns x <- matrix(1:4, 2, 2) # Getting the mat
    1 min read
  • Calculate the Cumulative Maxima of a Vector in R Programming - cummax() Function
    The cumulative maxima is the max value of elements 1 through l for an element l of the given variables. cummax() function in R Language is used to calculate the cumulative maxima of the values of vector passed as arguments. Syntax: cummax(x)  Parameters:  x: numeric object Example 1:  [GFGTABS] Pyth
    2 min read
  • Calculate the Cumulative Minima of a Vector in R Programming - cummin() Function
    cummin() function in R Language is used to calculate the cumulative minima of the values of vector passed as arguments. Syntax: cummin(x) Parameters: x: numeric object Example 1: # R program to cumulative minima # Calling cummin() function cummin(2:6) cummin(-2:-6) cummin(1.8:4.2) Output: [1] 2 2 2
    1 min read
  • Calculate exponential of a number in R Programming - exp() Function
    exp() function in R Language is used to calculate the power of e i.e. e^y or we can say exponential of y. The value of e is approximately equal to 2.71828….. Syntax: exp(y) Parameters: y: It is any valid R number either positive or negative. Returns: Floating point number by calculating e^y. Example
    1 min read
  • Convert a Numeric Object to Character in R Programming - as.character() Function
    as.character() function in R Language is used to convert a numeric object to character object. Syntax: as.character(x) Parameters: x: Numeric Object Example 1: # R program to convert a numeric object # to character object # Calling as.character() function as.character(1) as.character(2 + 3) as.chara
    1 min read
  • Calculate the Sum of Matrix or Array columns in R Programming - colSums() Function
    colSums() function in R Language is used to compute the sums of matrix or array columns. Syntax: colSums (x, na.rm = FALSE, dims = 1) Parameters: x: matrix or array dims: this is integer value whose dimensions are regarded as ‘columns’ to sum over. It is over dimensions 1:dims. Example 1: # R progra
    2 min read
  • Calculate cosine of a value in R Programming - cos() Function
    cos() function in R Language is used to calculate the cosine value of the numeric value passed to it as argument. Syntax: cos(x) Parameter: x: Numeric value Example 1: # R code to calculate cosine of a value # Assigning values to variables x1 <- 90 x2 <- 30 # Using cos() Function cos(x1) cos(x
    1 min read
  • Calculate the cross-product of the Transpose of a Matrix in R Programming - tcrossprod() Function
    tcrossprod() function in R Language is used to return the cross-product of the transpose of the specified matrix. Syntax: tcrossprod(x) Parameters: x: numeric matrix Example 1: # R program to illustrate # tcrossprod function # Initializing a matrix with # 2 rows and 2 columns x <- matrix(1:4, 2,
    1 min read
  • Calculate the Mean of each Column of a Matrix or Array in R Programming - colMeans() Function
    colMeans() function in R Language is used to compute the mean of each column of a matrix or array. Syntax: colMeans(x, dims = 1) Parameters: x: array of two or more dimensions, containing numeric, complex, integer or logical values, or a numeric data frame dims: integer value, which dimensions are r
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences