frequency | R Documentation |
This function returns the frequency of a time series. In the case of a sparse xts()
time series, and in other cases, the R functions xts::periodicity()
and frequency()
do not return BIMETS compliant values. Therefore, these functions have been extended.
## S3 method for class 'xts'
frequency(x,...)
x |
Input time series. |
... |
Backward compatibility. |
This function returns the integer value stored in the attribute .bimetsFreq
of the input time series, if any. Otherwise, the frequency will be calculated by using the shortest time difference between two observations, while accounting for day-saving and bissextile years.
normalizeYP
NUMPERIOD
BIMETS indexing
#build a sparse xts()
xArr<-rnorm(13)
dateArr<-seq(as.Date('2000/01/01'),by='6 months',length=10)
dateArr2<-seq(as.Date('2010/01/01'),by='3 months',length=3)
#strange array of dates here below...
dateArr3<-c(dateArr,dateArr2)
dataF<-data.frame(dateArr3,xArr)
xt<-xts(dataF[,2],order.by=dataF[,1])
#get bimets calculated frequency
cat(frequency(xt)) #print 4... without bimets R returns 1
#...legacy periodicity()
periodicity(xt)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.