I would like to make the same plot for each column of data in a data frame below called df.
Edit: to clarify, I would like to make a new plot for each column (Cop, CopN, Harp) etc as in my actual data I have many (i.e. far to many to try and grid on one plot) Id like to be able to create the plot below for each column.
Sample data:
day <- c('5-Aug', '5-Aug','5-Aug','10-Aug','10-Aug','10-Aug','17-Aug','17-Aug','17-Aug')
station <- c(1:3,1:3,1:3)
Cop.Mean <- c(382, 1017, 1519, 698, 5398, 2458, 346, 5722, 6253)
CopN.Mean <- c(233, 167, 530, 36, 124, 20, 427, 1768, 1486)
Harp.Mean <- c(20, 482, 10, 8, 4014, 7, 4, 46, 1)
df <- data.frame(day,station,Cop.Mean, CopN.Mean, Harp.Mean)
My plot:
library(ggplot2)
library(scales)
Cop.Plot <- ggplot(data=df, aes(x=station, y=Cop.Mean)) +
geom_point() + facet_grid(.~day)
print(Cop.Plot)
I would like to make this plot for each of the three columns of data I have in this example (i.e. df[3:5]) but haven't been able to figure out how to refer to multiple columns within aes(). (i.e.
aes(x=station, y=df[3:5])
doesn't work. I've also tried
i=df[3:5]
aes(x=station, y=i)
but I think I am likely not using the correct approach. Would anyone be so kind as to point me in the right direction? This seems like an extremely useful tool to learn how to do, and I am very eager to do so!