cumulative2current: convert cumulative value to current value

Description Usage Arguments Details Value See Also Examples

View source: R/cumulative_current.R

Description

some economic time series is cumulative value, and need to be converted to current value.

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 current value.

Value

A data frame.

See Also

current2cumulative

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)
cumulative2current(df,cycle = 5,start = 1 )
cumulative2current(df,cycle = 5,start = 2 )
cumulative2current(df,cycle = 5,start = 7 ) # fail
cumulative2current(df,cycle = 25 )  # when cycle > nobs.
cumulative2current(df,cycle = 50,50 )

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