I have a large, long dataset like this example:
df <- data.frame("Sample" = c("CM","PB","CM","PB"),"Compound" = c("Hydrogen","Hydrogen","Helium","Helium"), "Value" = c(8,3,3,2))
however I have about 162 rows (81 sample/compound pairs)
I am trying to write a loop that prints individual geom_col() plots of each compound where
x=Sample
y=Value
and there are 81 plots for each compound.
I think I am close with this loop:
I want i in "each compound" etc.
for (i in df$Compound){
print(ggplot(data = i),
aes(x=Sample,
y=Value))+
geom_col()
}
What am I missing from this loop? I have also tried facet_wrap(~Compound) However it looks like 81 is too large and each plot is tiny once made. I am looking for a full size bar graph of each compound.