I would like to use the same ggplot code to produce 8 different figures conditional upon figures in my dataframe. Usually I would use facet_grid, but in this case, I would like to end up with a pdf of each individual figure. For example, I would like one pdf for each row here:
df <- read.table(text = "
xvalue yvalue location planting crop
1 5 A early corn
2 3 A late corn
6 2 A early soy
7 4 A late soy
4 7 S early corn
2 6 S late corn
3 2 S early soy
5 1 S late soy
", sep = "", header = TRUE)
Basic ggplot:
library(ggplot2)
ggplot()+
geom_point(aes(x=xvalue, y=yvalue), data=df)
but instead of facet_grid
to get the location x planting x crop combos, I want one separate pdf of each.