Description Usage Arguments Details Value See Also Examples
View source: R/cumulative_current.R
some economic time series is cumulative value, and need to be converted to current value.
1 | cumulative2current(x, cycle = 12, start = 1)
|
x |
a numeric vector or a data frame |
cycle |
12 if monthly ; 4 if seasonal ... |
start |
start month or quarter ... |
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.
A data frame.
current2cumulative
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 )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.