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.136
#>  2 2022-01-01 dist2      1.28 
#>  3 2022-01-01 dist4     13.0  
#>  4 2022-01-03 dist1      1.73 
#>  5 2022-01-03 dist2      4.68 
#>  6 2022-01-03 dist4     13.3  
#>  7 2022-01-05 dist1      2.02 
#>  8 2022-01-05 dist2      4.77 
#>  9 2022-01-05 dist4     13.5  
#> 10 2022-01-07 dist1      2.45 
#> # ℹ 140 more rows

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