Description Usage Arguments Details Value Examples
This function takes irregularly-spaced observations in time and,
through a call to approx
, interpolates the data at a user-specified,
fixed grid of equally-spaced time points. The function is essentially a
wrapper to approx
that allows data frames as input (as opposed to
individual vectors for the x variable and time variable). As such, it
provides a useful framework for grouped data operations such as
plyr::ddply
.
1 2 |
data |
A data frame |
xvar |
Character string indicating the column name in |
timevar |
Character string indicating the column name in |
start |
Numeric value of the starting time over which the discrete time data
will be generated. Defaults to |
end |
Numeric value of the ending time over which the discrete time data
will be generated. Defaults to |
dt |
Numeric value representing the time increment of measurements over the
time interval given by |
method |
Interpolation method passed to |
rule |
Rule by which observations outside the interval
|
... |
Other parameters passed to |
The function ignores columns in data
other than xvar
and
timevar
.
A data frame containing equally-spaced, interpolated values of xvar
over the specified time grid. Other variables in data
are returned (assuming)
1 2 3 | irregularData <- tibble(value=1:10, t=c(1,4,5,7,8,10,11,13,17,21))
mapToDiscreteTime(irregularData, end=24, dt=2)
mapToDiscreteTime(irregularData, end=24, dt=0.5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.