I see, so maybe like this?
library(tidyverse)
tibble(
date = seq(as.Date("2023-10-01"), by = 1, length.out = 4),
min = 1:4,
max = 5:8
) -> depth
depth
#> # A tibble: 4 × 3
#> date min max
#> <date> <int> <int>
#> 1 2023-10-01 1 5
#> 2 2023-10-02 2 6
#> 3 2023-10-03 3 7
#> 4 2023-10-04 4 8
tibble(
date = seq(as.Date("2023-10-01"), by = 1, length.out = 4),
min = 11:14,
max = 15:18
) -> temp
temp
#> # A tibble: 4 × 3
#> date min max
#> <date> <int> <int>
#> 1 2023-10-01 11 15
#> 2 2023-10-02 12 16
#> 3 2023-10-03 13 17
#> 4 2023-10-04 14 18
If so, it would make plotting easier if the tables depth
and temp
were combined like this:
depth |>
mutate(measure = 'depth') |>
bind_rows(
temp |>
mutate(measure = 'temp')
) -> depth_plus_temp
depth_plus_temp
#> # A tibble: 8 × 4
#> date min max measure
#> <date> <int> <int> <chr>
#> 1 2023-10-01 1 5 depth
#> 2 2023-10-02 2 6 depth
#> 3 2023-10-03 3 7 depth
#> 4 2023-10-04 4 8 depth
#> 5 2023-10-01 11 15 temp
#> 6 2023-10-02 12 16 temp
#> 7 2023-10-03 13 17 temp
#> 8 2023-10-04 14 18 temp
and then the depth_plus_temp
table were reformatted to be longer
depth_plus_temp |>
pivot_longer(min:max, names_to = 'extreme') -> depth_plus_temp_long
depth_plus_temp_long
#> # A tibble: 16 × 4
#> date measure extreme value
#> <date> <chr> <chr> <int>
#> 1 2023-10-01 depth min 1
#> 2 2023-10-01 depth max 5
#> 3 2023-10-02 depth min 2
#> 4 2023-10-02 depth max 6
#> 5 2023-10-03 depth min 3
#> 6 2023-10-03 depth max 7
#> 7 2023-10-04 depth min 4
#> 8 2023-10-04 depth max 8
#> 9 2023-10-01 temp min 11
#> 10 2023-10-01 temp max 15
#> 11 2023-10-02 temp min 12
#> 12 2023-10-02 temp max 16
#> 13 2023-10-03 temp min 13
#> 14 2023-10-03 temp max 17
#> 15 2023-10-04 temp min 14
#> 16 2023-10-04 temp max 18
Created on 2024-04-01 with reprex v2.0.2
Could you do that with your tables and then post the following output?
depth_plus_temp_long |>
group_by(measure) |>
slice(1:50) |>
ungroup() |>
dput()