Description Usage Arguments Value Methods (by class) See Also Examples
Convert univariate time series objects from other R packages to "uts"
objects.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
x |
a time series object of appropriate type. |
... |
further arguments passed to or from methods. |
An object of class "uts"
.
ts
: convert a ts
object
fts
: convert an fts
object
irts
: convert an irts
object
xts
: convert an xts
object
zoo
: convert a zoo
object
as.uts_vector
(in package utsMultivariate
) for converting multivariate time series.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | # Convert a quarterly "ts"
ts1 <- ts(1:10, frequency = 4, start = c(1959, 2))
as.uts(ts1)
# Convert a monthly "ts"
ts2 <- ts(1:10, frequency = 12, start = c(1959, 8))
as.uts(ts2)
# Convert a yearly 'ts"
ts3 <- ts(1:10, frequency = 1, start = 1959)
as.uts(ts3)
# Convert an "fts"
if (requireNamespace("fts", quietly = TRUE)) {
fts1 <- fts::fts(index=as.POSIXct("2016-01-01") + dhours(c(1, 4, 27)), data=c(5,4,7))
as.uts(fts1)
}
# Convert an "irts"
if (requireNamespace("tseries", quietly = TRUE)) {
irts1 <- tseries::irts(as.POSIXct("2015-01-01") + days(c(1, 3, 7, 9)), 1:4)
as.uts(irts1)
}
# Convert an "xts"
if (requireNamespace("xts", quietly = TRUE)) {
xts1 <- xts::xts(1:4, as.Date("2015-01-01") + c(1, 3, 7, 9))
as.uts(xts1)
}
# Convert a "zoo"
if (requireNamespace("zoo", quietly = TRUE)) {
zoo1 <- zoo::zoo(1:4, as.Date("2015-01-01") + c(1, 3, 7, 9))
as.uts(zoo1)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.