View source: R/bimets_ts_functions.R
GETYEARPERIOD | R Documentation |
This function returns a two-element list (or a two-columns matrix in the case of JOIN=TRUE
) built with of the years and the periods of the input time series observations. Users can provide the output list names.
GETYEARPERIOD(x=NULL, YEARS='YEAR', PERIODS='PRD', JOIN=FALSE, avoidCompliance=FALSE, ...)
TSDATES(x=NULL, YEARS='YEAR', PERIODS='PRD', JOIN=FALSE, avoidCompliance=FALSE, ...)
x |
Input time series, that must satisfy the compliance control check defined in |
YEARS |
Argument of type string that will be the output list name for the array of observation years. |
PERIODS |
Argument of type string that will be the output list name for the array of observation periods. |
JOIN |
If |
avoidCompliance |
If |
... |
Backward compatibility. |
This function returns an object of class list()
. If JOIN=TRUE
, this function returns a matrix.
NOELS
TSERIES
is.bimets
BIMETS indexing
TSLEAD
TSINFO
TSLOOK
TABIT
ELIMELS
#create quarterly ts
n<-20
ts1<-TSERIES((n:1),START=c(2000,1),FREQ=4)
myYP<-GETYEARPERIOD(ts1)
print(myYP$YEAR) #print 2000 2000 ...
print(myYP$PRD) #print 1 2 3 4 1 2 ...
#create monthly ts
ts1<-TSERIES((n:1),START=c(2000,1),FREQ='M')
myYP<-GETYEARPERIOD(ts1)
print(myYP$YEAR) #print 2000 2000 ...
print(myYP$PRD) #print 1 2 3 4 5 6 7 ...
#create yearly ts
ts1<-TSERIES((1:n),START=c(2000,1),FREQ=1)
myYP<-GETYEARPERIOD(ts1,YEARS='YEARSS', PERIODS='PRDSS')
print(myYP$YEARSS) #print 2000 2001 2002 ...
print(myYP$PRDSS) #print 1 1 1 1.....
#JOIN=TRUE
ts1<-TSERIES((n:1),START=c(2000,1),FREQ='M')
myYP<-GETYEARPERIOD(ts1,JOIN=TRUE)
print(myYP) #print 2000 2000 ...
# [,1] [,2]
#[1,] 2000 1
#[2,] 2000 2
#[3,] 2000 3
#...
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.