Learn R Programming

TSstudio (version 0.1.7)

ts_decompose: Visualization of the Decompose of a Time Series Object

Description

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

Usage

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

Run this code
# 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")

Run the code above in your browser using DataLab