Below is a subset of my dataframe (Infil_Data). What I am looking to do is save each scatter plot as a different page in a pdf. So for this case I would have a pdf called "new_file", the first page would contain scatter plot A1 and the second page would contain scatter plot A2. I have been reading through a book called, "R for Data Science", by Garrett Grolemund and Hadley Wickham and have come up with, but am not sure how to save individual plots:
ggplot(data = Infil_Data) + geom_point(mapping = aes(x = Sqrt_Time.x,
y = Calc_Vol_cm)) + facet_wrap(~Site.ID, nrow = 10)
tibble::tribble(
~Time.x, ~Site.ID, ~Sqrt_Time.x, ~Calc_Vol_cm,
0L, "A1", 0, 0L,
30L, "A1", 5.477225575, 1L,
60L, "A1", 7.745966692, 2L,
90L, "A1", 9.486832981, 3L,
120L, "A1", 10.95445115, 4L,
150L, "A1", 12.24744871, 5L,
180L, "A1", 13.41640786, 6L,
210L, "A1", 14.49137675, 7L,
240L, "A1", 15.49193338, 8L,
270L, "A1", 16.43167673, 9L,
300L, "A1", 17.32050808, 10L,
0L, "A2", 0, 0L,
30L, "A2", 5.477225575, 2L,
60L, "A2", 7.745966692, 4L,
90L, "A2", 9.486832981, 6L,
120L, "A2", 10.95445115, 8L,
150L, "A2", 12.24744871, 10L,
180L, "A2", 13.41640786, 12L,
210L, "A2", 14.49137675, 14L,
240L, "A2", 15.49193338, 16L,
270L, "A2", 16.43167673, 18L,
300L, "A2", 17.32050808, 20L
)
#> # A tibble: 22 x 4
#> Time.x Site.ID Sqrt_Time.x Calc_Vol_cm
#> <int> <chr> <dbl> <int>
#> 1 0 A1 0 0
#> 2 30 A1 5.48 1
#> 3 60 A1 7.75 2
#> 4 90 A1 9.49 3
#> 5 120 A1 11.0 4
#> 6 150 A1 12.2 5
#> 7 180 A1 13.4 6
#> 8 210 A1 14.5 7
#> 9 240 A1 15.5 8
#> 10 270 A1 16.4 9
#> # ... with 12 more rows