frequency {bimets} | R Documentation

## Frequency of a Time Series

### Description

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. We suggest to use this function when a BIMETS time series frequency is requested.

### Usage

    ## S3 method for class 'xts'
    frequency(x,...)

### Arguments

`x` | Input time series.
`...` | Backward compatibility.

### Value

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 daysaving and bissextile years.

### See Also

`normalizeYP`
`NUMPERIOD`
`BIMETS indexing`

### Examples

    	#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);

[Package bimets version 1.4.0 Index]