I would like to create graphs for multiple variables and save the graphs without have to type the same code over and over.
Variables: Var1, Var2, Var3
vars <- c( "Var1", "Var2", "Var3" )
for (v in vars) {
Graph_v <- D %>%
ggplot(mapping = aes(x= X, y= v)) + geom_point(aes(x= X, y= v)) +
stat_summary(
fun.data = mean_se,
geom = "line", size = 1)
}
My main problem is to safe the single graphs under different names.
Thanks for your help. Hanna
R will only safe the latest graph created because the name of the graph does not change.