Movatterモバイル変換


[0]ホーム

URL:


rdrr.io

cumsum: Cumulative Sums, Products, and Extremes

cumsumR Documentation

Cumulative Sums, Products, and Extremes

Description

Returns a vector whose elements are the cumulative sums, products,minima or maxima of the elements of the argument.

Usage

cumsum(x)cumprod(x)cummax(x)cummin(x)

Arguments

x

a numeric or complex (notcummin orcummax)object, or an object that can be coerced to one of these.

Details

These are generic functions: methods can be defined for themindividually or via theMath group generic.

Value

A vector of the same length and type asx (after coercion),except thatcumprod returns a numeric vector for integer input(for consistency with*). Names are preserved.

AnNA value inx causes the corresponding and followingelements of the return value to beNA, as does integer overflowincumsum (with a warning).

S4 methods

cumsum andcumprod are S4 generic functions:methods can be defined for them individually or via theMath group generic.cummax andcummin are individually S4 generic functions.

References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)The New S Language.Wadsworth & Brooks/Cole. (cumsum only.)

Examples

cumsum(1:10)cumprod(1:10)cummin(c(3:1, 2:0, 4:2))cummax(c(3:1, 2:0, 4:2))

What can we improve?

R Package Documentation

Browse R Packages

We want your feedback!

Note that we can't provide technical support on individual packages. You should contact the package authors for that.

 
Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, readEmbedding Snippets.

Close

[8]ページ先頭

©2009-2026 Movatter.jp