What I have been working on is an iteration with ggplot. I'll take a dataframe and create a scatter plot with a regression line with an order of 2 for each unique Site ID level and then export to a one page PDF. So the first page would have Site ID 1, second page would have Site ID 2, and so on and so forth. I am having trouble displaying the regression line equation. I have been working with a user on Stakeoverflow, but have not been able to replicate his solution.

The issue I am having is with the function "stat_smooth_func". I am being returned with an error, "Error: geom_text requires the following missing aesthetics: label". I have tried looking up stat_smooth_func, but am unable to find it in the R help section or much online either.

```
library(tidyverse)
library(purrr)
Infil_Data2 <- tibble::tribble(
~Time, ~Site_ID, ~Vol_mL, ~Sqrt_Time.x, ~Cal_Vol_cm,
0L, "H1", 63, 0, 0,
30L, "H1", 62, 5.477225575, 0.124339799,
60L, "H1", 60, 7.745966692, 0.373019398,
90L, "H1", 59, 9.486832981, 0.497359197,
120L, "H1", 58, 10.95445115, 0.621698996,
150L, "H1", 56, 12.24744871, 0.870378595,
180L, "H1", 54, 13.41640786, 1.119058194,
210L, "H1", 52.5, 14.49137675, 1.305567893,
240L, "H1", 50, 15.49193338, 1.616417391,
270L, "H1", 48.5, 16.43167673, 1.80292709,
300L, "H1", 46.5, 17.32050808, 2.051606688,
0L, "H2", 82, 0, 0,
30L, "H2", 77, 5.477225575, 0.621698996,
60L, "H2", 73, 7.745966692, 1.119058194,
90L, "H2", 68, 9.486832981, 1.74075719,
120L, "H2", 65, 10.95445115, 2.113776588,
150L, "H2", 51, 12.24744871, 3.854533778,
180L, "H2", 56, 13.41640786, 3.232834782,
210L, "H2", 52, 14.49137675, 3.730193979,
240L, "H2", 47.5, 15.49193338, 4.289723076,
270L, "H2", 42.5, 16.43167673, 4.911422072,
300L, "H2", 37.5, 17.32050808, 5.533121068,
0L, "H3", 69, 0, 0,
30L, "H3", 67, 5.477225575, 0.248679599,
60L, "H3", 65, 7.745966692, 0.497359197,
90L, "H3", 63, 9.486832981, 0.746038796,
120L, "H3", 61, 10.95445115, 0.994718394,
150L, "H3", 60, 12.24744871, 1.119058194,
180L, "H3", 58, 13.41640786, 1.367737792,
210L, "H3", 56, 14.49137675, 1.616417391,
240L, "H3", 54, 15.49193338, 1.865096989,
270L, "H3", 51.5, 16.43167673, 2.175946488,
300L, "H3", 49, 17.32050808, 2.486795986
)
#> # A tibble: 33 x 5
#> Time Site_ID Vol_mL Sqrt_Time.x Cal_Vol_cm
#> <int> <chr> <dbl> <dbl> <dbl>
#> 1 0 H1 63 0 0
#> 2 30 H1 62 5.48 0.124
#> 3 60 H1 60 7.75 0.373
#> 4 90 H1 59 9.49 0.497
#> 5 120 H1 58 11.0 0.622
#> 6 150 H1 56 12.2 0.870
#> 7 180 H1 54 13.4 1.12
#> 8 210 H1 52.5 14.5 1.31
#> 9 240 H1 50 15.5 1.62
#> 10 270 H1 48.5 16.4 1.80
#> # ... with 23 more rows
plot_5 <-
Infil_Data2 %>%
split(.$Site_ID) %>%
map2(names(.),
~ggplot(.x, aes(Sqrt_Time.x, Cal_Vol_cm)) +
geom_point() +
labs(title = paste(.y)) +
theme(plot.title = element_text(hjust = 0.5)) +
stat_smooth_func(geom="text", method = "lm", hjust=0, parse=TRUE) +
stat_smooth(mapping = aes(x = Sqrt_Time.x, y = Cal_Vol_cm),
method = "lm", se = FALSE,
formula = y ~ poly(x, 2, raw = TRUE),
color = "red") +
theme(plot.margin = unit(c(1, 5, 1, 1), "cm")) +
stat_smooth_func(geom = "text", method = "lm", hjust = 0, parse = TRUE))
pdf("allplots5.pdf", onefile = TRUE)
walk(plot_5, print)
dev.off()
```