Learn R Programming

gmp (version 0.5-13)

cumsum: (Cumulative) Sums, Products of Large Integers and Rationals

Description

Theses are methods to ‘overload’ the sum(), cumsum() and prod() functions for big rationals and big integers.

Usage

"cumsum"(x) "cumsum"(x) "sum"(..., na.rm = FALSE) "sum"(..., na.rm = FALSE) "prod"(..., na.rm = FALSE) "prod"(..., na.rm = FALSE)

Arguments

x, ...
R objects of class bigz or bigq or ‘simple’ numbers.
na.rm
logical indicating if missing values (NA) should be removed before the computation.

Value

return an element of class bigz or bigq.

See Also

apply

Examples

Run this code
 x <- as.bigz(1:12)
 cumsum(x)
 prod(x)
 sum(x)

 x <- as.bigq(1:12)
 cumsum(x)
 prod(x)
 sum(x)

Run the code above in your browser using DataLab