Thank you for this wonderful community. I am trying to create a loop to make lots of graphs. However, only the last graph is being shown.
Here is my dataset. I am essentially subsetting by gene and then trying to create graphs.
Here is my code.
data_before_heart <- subset(data_before, Organ == 0)
uniq <- unique(unlist(data_before_heart$Gene))
for (i in 1:length(uniq)){
data_1 <- subset(data_before_heart, Gene == uniq[i])
print(ggplot(data_1, aes(x=Drug, y=Expression)) +
geom_bar(stat="identity"))
}
Unfortunately this only generates the last graph. (there are 6 genes from 0, 1, 2, 3, 4, 5)