Skip to contents

Plots a fancy time series

Usage

fancy_ts(df, val, group)

Arguments

df

data.frame

val

value var

group

group var

Value

A tibble with the summarized data

Examples

df <- dplyr::tibble(
   dist1 = sort(rnorm(50, 5, 2)),
   dist2 = sort(rnorm(50, 8, 3)),
   dist4 = sort(rnorm(50, 15, 1)),
   date = seq.Date(
      as.Date("2022-01-01"),
      as.Date("2022-04-10"),
      by = "2 days")) |>
tidyr::pivot_longer(
   cols = -date,
   names_to = "dist_name",
   values_to = "value")

df
#> # A tibble: 150 × 3
#>    date       dist_name  value
#>    <date>     <chr>      <dbl>
#>  1 2022-01-01 dist1     -0.501
#>  2 2022-01-01 dist2     -0.922
#>  3 2022-01-01 dist4     12.5  
#>  4 2022-01-03 dist1      1.45 
#>  5 2022-01-03 dist2      2.87 
#>  6 2022-01-03 dist4     13.1  
#>  7 2022-01-05 dist1      1.83 
#>  8 2022-01-05 dist2      3.30 
#>  9 2022-01-05 dist4     13.1  
#> 10 2022-01-07 dist1      1.96 
#> # ℹ 140 more rows

fancy_ts(df, value, dist_name) +
gg_theme()