Description Usage Arguments Value Examples
Sample each time series in a "uts_vector"
at given sampling times and combine the sampled values into a matrix
or data.frame
.
1 2 |
x |
a |
time_points |
a strictly increasing sequence of |
... |
arguments passed to |
drop |
logical. If |
A matrix
if all sampled observation values are of the same type
, and a data.frame
otherwise. However, when using argument drop=TRUE
the result may be simplified further.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | times <- as.POSIXct(c("2007-11-09", "2007-11-10"))
# Sample with last-point and linear interpolation
sample_values(ex_uts_vector(), times)
sample_values(ex_uts_vector(), times, interpolation="linear")
# Sample with and without dropping of length-one dimensions
sample_values(ex_uts_vector(), times[1])
sample_values(ex_uts_vector(), times[1], drop=FALSE)
# Store sampled values in data.frame if of different type
x <- ex_uts()
y <- uts(letters[1:6], x$times)
utsv <- c(x, y)
sample_values(utsv, times)
# Error, because not all time series have atomic observation values
## Not run: sample_values(ex_uts_vector2(), times)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.