Interactive visualization the trend, seasonal and random components of a time series based on the decompose function from the stats package.

ts_decompose(ts.obj, type = "additive", showline = TRUE)

Arguments

ts.obj

a univariate time series object of a class "ts", "zoo" or "xts"

type

Set the type of the seasonal component, can be set to either "additive", "multiplicative" or "both" to compare between the first two options (default set to “additive”)

showline

Logic, add a separation line between each of the plot components (default set to TRUE)

Examples

# Defualt decompose plot ts_decompose(AirPassengers) # Remove the sepration lines between the plot components ts_decompose(AirPassengers, showline = FALSE) # Plot side by side a decompose of additive and multiplicative series ts_decompose(AirPassengers, type = "both")