data_frame_to_zoo: Function to transform a data frame into a *zoo* time series...

View source: R/data_frame_to_zoo.R

data_frame_to_zooR Documentation

Function to transform a data frame into a zoo time series object.

Description

Function to transform a data frame into a zoo time series object.

Usage

data_frame_to_zoo(df)

Arguments

df

Data frame or tibble containing a parsed date variable named "date".

Value

zoo series.

Author(s)

Stuart K. Grange.

Examples


# Example data
data_example <- structure(
list(
  date = structure(c(1238713200, 1238799600, 1238886000, 1238972400, 1239058800),
  class = c("POSIXct", "POSIXt"), tzone = "Etc/GMT-1"),
  value = c(0.299977143295109, 0.491486074170098, 0.792906971182674, 
  0.0756499643903226, 0.00722031807526946)
), 
class = "data.frame", row.names = c(NA, -5L)
)

# To zoo series, date variable needed
zoo_df <- data_frame_to_zoo(data_example)


skgrange/threadr documentation built on April 15, 2024, 9:35 p.m.