How to plot using facet_wrap, over multiple pages as a .pdf files in r cran
Depending on the shape of your plots, it might make sense to create four separate plots. I suggest this just because it makes sense to show the axes and labels on each individual page, otherwise it could be that the reader would have to always flips back to e.g. page 1 to see what the scales are.

I would probably do something like a 6 (rows) by 5 (columns) on each page, assuming portrait page orientation. Then you need to just adjust your code to do something like this (as pseudo-code):

page1 &lt;- ggplot(steps[0:30]), aes(x=factor(edu))) + geom_bar(aes(y = (..count..), group = id_study,)) + facet_wrap(~id_study,)

page2 &lt;- ggplot(steps[30:60]), aes(x=factor(edu))) + geom_bar(aes(y = (..count..), group = id_study,)) + facet_wrap(~id_study,)

page3 &lt;- ggplot(steps[60:90]), aes(x=factor(edu))) + geom_bar(aes(y = (..count..), group = id_study,)) + facet_wrap(~id_study,)

page4 &lt;- ggplot(steps[90:114]), aes(x=factor(edu))) + geom_bar(aes(y = (..count..), group = id_study,)) + facet_wrap(~id_study,)


Then continue to export the images as you require, for example:

ggsave('./first_page_plots.pdf', page1, dpi=600)


check out more save options here.