Description Usage Arguments Details Value Note Examples
Create an unevenly spaced time series ("uts") object from a vector of observation values and a vector of observation times of matching length.
is.uts returns TRUE if its argument is a "uts" object.
is.uts_virtual returns TRUE if its argument is a "uts_virtual" object.
1 2 3 4 5 | uts(values = numeric(), times = as.POSIXct(character()))
is.uts(x)
is.uts_virtual(x)
|
values |
a vector of observation values. |
times |
a vector of strictly increasing observation times. Must be a |
x |
an R object. |
As shown in an example below, it is possible to store arbitrary R objects in a "uts" object. However, many time series methods work only when the observation values are of a certain class or type. For example, arithmetic methods require the observation values to be numeric (i.e. double or integer), logical, or complex; plotting only works for numeric and logical values; while as.data.frame.uts requires atomic observation values.
An object of class "uts".
An abstract class "uts_virtual" exists from which "uts", "uts_vector", and "uts_matrix", inherit (see package utsMultivariate for the latter three classes): it is used to allow operations such as subtraction to mix the classes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # Create a numeric "uts"
dts <- c("2007-11-08", "2007-11-08", "2007-11-08", "2007-11-09", "2007-11-09", "2007-11-09")
tms <- c("7:00:00", "8:01:00", "13:15:00", "7:30:00", "8:51:00", "15:15:00")
uts(values=c(48.375, 48.5, 48.375, 47, 47.5, 47.35), times=paste(dts, tms))
# Store arbitrary R objects in a "uts"
uts(list(1:5, c("a", "B")), c("2007-11-08 1:01:00", "2007-11-09 15:16:00"))
# Create an empty "uts"
uts()
# All of the following are TRUE
is.uts(ex_uts())
is.uts_virtual(ex_uts())
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.