fromBIMETStoXTS {bimets}R Documentation

Convert BIMETS to XTS

Description

This function transforms a BIMETS compliant time series (as defined in is.bimets) into a time series of class xts().
The core XTS function as.xts() does not satisfy all the compliance control check requirements, so it has been extended. If the output time series will have an .indexClass of type Date(), i.e. neither monthly nor quarterly, the output dates will be chosen accordingly to the BIMETS option BIMETS_CONF_DIP: if this option is set to LAST (default), the output xts() time series will have the date of the period set equal to the last day in the same period, e.g. 31 December for yearly time series, 30 June for semiannual, etc.; if the BIMETS option BIMETS_CONF_DIP is set to FIRST, the output xts() time series will have the date of the period set equal to the first day in the same period, e.g. 1 January for yearly time series, 1 July for semiannual time series on the second period, etc.
In the case of quarterly time series the .indexClass=yearqtr;
in the case of monthly time series the .indexClass=yearmon.
Attributes and description of the input time series will be copied to the output time series (see TIMESERIES)

Usage

fromBIMETStoXTS(x = NULL, ...)

Arguments

x

Input time series that must satisfy the compliance control check defined in is.bimets.

...

Backward compatibility.

Value

This function returns a time series of class xts() that has the same observations of the input BIMETS time series.

See Also

fromBIMETStoTS
as.bimets
is.bimets
BIMETS indexing
BIMETS configuration

Examples

	
	#create yearly time series
	ts<-TSERIES(1:10,START=c(2000,1),FREQ='A')
	print(is.xts(ts))#FALSE
	#convert to xts
	xts<-fromBIMETStoXTS(ts)
	print(is.xts(xts))#TRUE
	print(xts)
	
	#create monthly time series
	ts<-TSERIES(1:10,START=c(2000,1),FREQ='M')
	print(is.xts(ts))#FALSE
	#convert to xts
	xts<-fromBIMETStoXTS(ts)
	print(is.xts(xts))#TRUE
	print(xts)
	
	#create daily time series
	ts<-TSERIES(1:10,START=c(2000,1),FREQ='D')
	print(is.xts(ts))#FALSE
	#convert to xts
	xts<-fromBIMETStoXTS(ts)
	print(is.xts(xts))#TRUE
	print(xts)
	
	#create yearly time series with first date on period
	setBIMETSconf('BIMETS_CONF_DIP','FIRST')
	ts<-TSERIES(1:10,START=c(2000,1),FREQ='A')
	print(is.xts(ts))#FALSE
	#convert to xts
	xts=fromBIMETStoXTS(ts)
	print(is.xts(xts))#TRUE
	print(xts)#dates on Jan 1
	
	#reset default
	setBIMETSconf('BIMETS_CONF_DIP','LAST')
	
	

[Package bimets version 3.0.2 Index]