I want to plot 10 figures, with the same variable(s), but different actors (I want to have a plot for every actor).
actor1 <- subset (actor, actor$Actor=="Actor1")
plot_actor1 <- ggplot(actor1, aes(x = Date, y = Var))+
geom_point(shape=15)
ylim(0,30)+
geom_hline(yintercept=12)+
geom_hline(yintercept=17)+
theme_bw()
pdf("actor1", paper='A4r', width=11)
actor1
dev.off()
Data ("actor" - excerpt):
Actor Date Var
Actor1 0101 12
Actor1 0102 14
Actor1 0103 17
Actor1 0104 11
Actor1 0105 9
Actor1 0106 21
Actor2 0101 6
Actor2 0102 17
Actor2 0103 15
Actor2 0104 19
Actor2 0105 25
Actor2 0106 3
I could do that manually, but isn't there another solution (with a loop or a function), where I can replace the "actor1" with names of all my actors (from actor1 until actor10)?