Hello. I am using a package wqtrends. It outputs trend plots based on a GAM output. I want to modfiy (add another series of data to these plots--using a second dataframe--it has the same X-values). But, I am getting an error. Any help would be appreciated. Thank you.
Some of the data to put into the model:
**head(tomod**)
# A tibble: 6 × 8
date station param value doy cont_year yr mo
<date> <fct> <fct> <dbl> <dbl> <dbl> <dbl> <ord>
1 2014-12-01 9B tp 0.24 335 2015. 2014 Dec
2 2015-02-01 9B tp 0.56 32 2015. 2015 Feb
3 2015-07-01 9B tp 0.122 182 2015. 2015 Jul
4 2015-11-01 9B tp 0.112 305 2016. 2015 Nov
5 2016-02-01 9B tp 0.163 32 2016. 2016 Feb
6 2016-05-01 9B tp 0.13 122 2016. 2016 May
#> Error in parse(text = input): <text>:3:14: unexpected symbol
#> 2: # A tibble: 6 × 8
#> 3: date station
The data I want to add to the model output:
tibble::tribble(
~yr, ~threshold, ~top, ~thresh.comp,
2014, 0.2, 0.3, "gray",
2015, 0.2, 0.3, "gray",
2016, 0.2, 0.3, "white",
2017, 0.2, 0.3, "black",
2018, 0.2, 0.3, "gray",
2019, 0.2, 0.3, "white",
2020, 0.2, 0.3, "white",
2021, 0.2, 0.3, "white",
2022, 0.2, 0.3, "white",
2023, 0.2, 0.3, "white",
2024, 0.2, 0.3, "white"
)
The model: ```
mod <- anlz_gam(tomod, trans = "log10") ## Note: use trans = 'ident' to use untransformed data!
#> Error in anlz_gam(tomod, trans = "log10"): could not find function "anlz_gam"
mod
#> Error: object 'mod' not found
**The plot:**
``` r
plot3 <- show_trndseason(mod, doystr = 1, doyend = 365, justify = 'right', win = 5, ylab = ylab)
#> Error in show_trndseason(mod, doystr = 1, doyend = 365, justify = "right", : could not find function "show_trndseason"
plot3 + geom_point(data = df2, aes(x = yr, y = top))
#> Error: object 'plot3' not found
Created on 2025-02-17 with reprex v2.1.1