Learn R Programming

sysid (version 1.0.4)

dataSlice: Subset or Resample idframe data

Description

dataSlice is a subsetting method for objects of class idframe. It extracts the subset of the object data observed between indices start and end. If a frequency is specified, the series is then re-sampled at the new frequency.

Usage

dataSlice(data, start = NULL, end = NULL, freq = NULL)

Arguments

data
an object of class idframe
start
the start index
end
the end index
freq
fraction of the original frequency at which the series to be sampled.

Value

an idframe object

Details

The dataSlice function extends the window function for idframe objects

See Also

window

Examples

Run this code
data(cstr)
cstrsub <- dataSlice(cstr,start=200,end=400) # extract between indices 200 and 400
cstrTrain <- dataSlice(cstr,end=4500) # extract upto index 4500
cstrTest <- dataSlice(cstr,start=6501) # extract from index 6501 till the end
cstr_new <- dataSlice(cstr,freq=0.5) # resample data at half the original frequency  

Run the code above in your browser using DataLab