tsd {aedseo}R Documentation

Create a S3 aedseo_tsd (time-series data) object from observed data and corresponding dates.

Description

[Stable]

This function takes observed data and the corresponding date vector and converts it into a aedseo_tsd object, which is a time series data structure that can be used for time series analysis.

Usage

tsd(observed, time, time_interval = c("day", "week", "month"))

Arguments

observed

A numeric vector containing the observations.

time

A date vector containing the corresponding dates.

time_interval

A character vector specifying the time interval. Choose between "day," "week," or "month."

Value

A aedseo_tsd object containing:

Examples

# Create a `aedseo_tsd` object from daily data
daily_tsd <- tsd(
  observed = c(10, 15, 20, 18),
  time = as.Date(
    c("2023-01-01", "2023-01-02", "2023-01-03", "2023-01-04")
  ),
  time_interval = "day"
)

# Create a `aedseo_tsd` object from weekly data
weekly_tsd <- tsd(
  observed = c(100, 120, 130),
  time = as.Date(
    c("2023-01-01", "2023-01-08", "2023-01-15")
  ),
  time_interval = "week"
)

# Create a `aedseo_tsd` object from monthly data
monthly_tsd <- tsd(
  observed = c(500, 520, 540),
  time = as.Date(
    c("2023-01-01", "2023-02-01", "2023-03-01")
  ),
  time_interval = "month"
)


[Package aedseo version 0.1.2 Index]