ts_random_walk_ggplot_layers: Get Random Walk 'ggplot2' layers

View source: R/diagnostic_plots.R

ts_random_walk_ggplot_layersR Documentation

Get Random Walk ggplot2 layers

Description

Get layers to add to a ggplot graph from the ts_random_walk() function.

Usage

ts_random_walk_ggplot_layers(.data)

Arguments

.data

The data passed to the function.

Details

  • Set the intercept of the initial value from the random walk

  • Set the max and min of the cumulative sum of the random walks

Value

A ggplot2 layers object

Author(s)

Steven P. Sanderson II, MPH

Examples

library(ggplot2)

df <- ts_random_walk()

df %>%
  ggplot(
    mapping = aes(
      x = x
      , y = cum_y
      , color = factor(run)
      , group = factor(run)
   )
 ) +
 geom_line(alpha = 0.8) +
 ts_random_walk_ggplot_layers(df)


healthyR.ts documentation built on Nov. 15, 2023, 9:07 a.m.