Learn R Programming

wmtsa (version 1.1-1)

create.signalSeries: Converts various time series to an object of class

Description

Converts numeric data to an object of class containing one dimensional data. The input data is assumed to be uniformly sampled.

Usage

create.signalSeries(x=NULL, position=list(from=1,by=1,units=character()),
    from=NULL, by=NULL, to=NULL, length.out=NULL,
    units=character(), title.data=character(), documentation=character(), na.rm=TRUE)

Arguments

by
a numeric containing the sampling rate at which the values in data should be extracted. This parameter must coordinate with the position arguments and can be used in combination with the by, to, or
documentation
a string used to describe the input data. Default: character().
from
a list containing the arguments from, by and to which describe the position(s) of the input data. All position arguments need not be specified as missing members will be filled in by their default values
length.out
an integer containing the maximum number of values to extract from data. Because data is a finite length sequence, the actual number of values returned may be less than that specified by this argument depending upon the condition
na.rm
a logical flag used to indicate if NaN values should be removed from the input. Default: TRUE.
position
a list containing the arguments from, by and to which describe the position(s) of the input data. All position arguments need not be specified as missing members will be filled in by their default values
title.data
a string representing the name of the input data. Default: character().
to
a numeric containing the end point in data from which the values should be extracted. This parameter must coordinate with the position arguments and can be used in combination with the by and to argument
units
a string denoting the units of the time series. Default: character().
x
a numeric vector, matrix or an object of class ts (uniform sampling assumed). If a matrix, the longest first row or column is extracted. Default: NULL (no data).

Value

  • an object of class signalSeries.

concept

utilities

See Also

make.signal.

Examples

Run this code
## convert an explicitly developed numeric vector 
x <- 1:10
create.signalSeries(x)

## now impose hypothetical positions on the data 
create.signalSeries(x, pos=list(from=0.3, by=0.1))

## extract the values from position 0.5 onward 
create.signalSeries(x, pos=list(from=0.3, by=0.1), from=0.5)

## extract the values from position 0.5 onward, 
## but keep only the first 3 values of the 
## extraction 
create.signalSeries(x, pos=list(from=0.3, by=0.1), from=0.5, length=3)

## extract the values from position 0.5 onward and 
## skip every other point (sample the data at 
## 0.2 position intervals) 
create.signalSeries(x, pos=list(from=0.3, by=0.1), from=0.5, by=0.2)

## simply return the first 4 values, and supply a 
## title and some documentation comments to the 
## data 
create.signalSeries(x, length=4, title="Faux Data", doc="An example")

Run the code above in your browser using DataLab