as.data.frame.uts: Coerce to a Data Frame

Description Usage Arguments Note Examples

View source: R/uts.R

Description

Flatten a "uts" to a two-column data.frame, with the observation times in first column and observation values in the second column. The column names are "time" and "value".

Usage

1
2
## S3 method for class 'uts'
as.data.frame(x, ...)

Arguments

x

a "uts" object.

...

further arguments passed to or from methods.

Note

Only time series with atomic observation values can be coerced to a data.frame.

This method is helpful for saving a time series to a human-readable text file.

Examples

1
2
3
4
5
6
7
as.data.frame(ex_uts())

# Save a time series to a text file with nice date formatting
uts1 <- uts(rnorm(10), Sys.time() + days(1:10))
data <- as.data.frame(uts1)
data$time <- format(data$time, format="%Y-%m-%d")
## Not run: write.csv(data, file="random.csv", row.names=FALSE, quote=FALSE)

andreas50/uts documentation built on April 8, 2021, 10:03 a.m.