TSTRIM {bimets} | R Documentation

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

`TSLAG`
`TSJOIN`
`TSMERGE`
`TSPROJECT`
`CUMSUM`
`INDEXNUM`

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

[Package bimets version 1.4.0 Index]