Skip to contents

animate_interval() creates an animated plot using a cleanTS object and a interval.

Usage

animate_interval(obj, interval)

Arguments

obj

A cleanTS object.

interval

A numeric or character, specifying the viewing interval.

Value

A list containing:

  • animation: A gganim object.

  • nstates: The number of states in the animation.

Details

First, the data is split according to the interval argument passed to the function. If it is a numeric value, the cleaned data is split into dataframes containing interval observations. It can also be a string, like 1 week, 3 months, 14 days, etc. In this case, the data is split according to the interval given, using the timestamp column. Then an animation is created using the spliited data, with the help of gganimate package. The animate_interval() function returns a list containing the gganim object used to generate the animation and the number of states in the data. The animation can be generated using the gen.animation() function and saved using the anim_save() function. The plots in the animation also contain a short summary, containing the statistical information and the number of missing values, outliers, missing timestamps, and duplicate timestamps in the data shown in that frame of animation.

Examples

if (FALSE) {
  # Create a `gganim` using `animate_interval()` function
  a <- animate_interval(cts, "10 year")

  # cts -> `cleanTS` object created using `cleanTS()`.
}