current2cumulative: convert current value to cumulative value

Description Usage Arguments Details Value See Also Examples

Description

sometimes should convert current value to cumulative value if necessity, although using current value is common.

Usage

1

Arguments

x

a numeric vector or a data frame

cycle

12 if monthly ; 4 if seasonal ...

start

start month or quarter ...

Details

No matter what class of x (vector or data.frame), output value will be a data frame. If x is data frame, progress will convert it's all columns to cumulative value.

Value

A data frame.

See Also

cumulative2current

Examples

1
2
3
4
5
6
7
8
9
a = c(1:10)
b = c(1,3,6,1,8,4,2,9,10,3)
c = c(rep(c(1,2,3),c(2,3,5)))
df = data.frame(a,b,c)
current2cumulative(df,cycle = 5,start = 1 )
current2cumulative(df,cycle = 5,start = 2 )
current2cumulative(df,cycle = 5,start = 7 ) # fail
current2cumulative(df,cycle = 25 )  # when cycle > nobs.
current2cumulative(df,cycle = 50,50 )

Nisus-Liu/CompositeIndex documentation built on May 7, 2019, 6:18 p.m.