Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

TSTRIM

Trim a Time Series


Description

This function removes trailing or leading missing values NA from the input array or the input time series. Users can provide the value to be removed other than NA missing vallue by using the argument VALUE.

Usage

TSTRIM(x=NULL, VALUE=NA, TRAIL=TRUE, LEAD=TRUE, avoidCompliance=FALSE, ...)

Arguments

x

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

VALUE

Target value to be removed. Default to missing value NA.

TRAIL

If TRUE this function will remove trailing target values from the input time series.

LEAD

If TRUE this function will remove leading target values from the input time series.

avoidCompliance

If TRUE, compliance control check of input time series will be skipped. See is.bimets

...

Backward compatibility.

Value

This function returns an object of the same class of the input, i.e. an array or a BIMETS time series, built by removing leading and trailing user-defined values.

See Also

Examples

#TS A
	n=10
	ts1=TSERIES(c(NA,1:n,NA),START=c(2000,1),FREQ='A')
	TABIT(ts1,TSTRIM(ts1))
		
	ts1=TSERIES(c(NA,1:n,NA),START=c(2000,1),FREQ='A')
	TABIT(ts1,TSTRIM(ts1,TRAIL=FALSE))
	
	ts1=TSERIES(c(NA,1:n,NA),START=c(2000,1),FREQ='A')
	TABIT(ts1,TSTRIM(ts1,LEAD=FALSE))
	
	ts1=TSERIES(c(0,0,NA,1:n,NA,0),START=c(2000,1),FREQ='A')
	TABIT(ts1,TSTRIM(ts1,0))

bimets

Time Series and Econometric Modeling

v1.5.3
GPL-3
Authors
Andrea Luciani [aut, cre], Roberto Stok [aut], Bank of Italy [cph]
Initial release
2021-02-04

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.