I'm trying to do two ggplots of a list of dataframes
I have this list:
list.function <- function() {
sample1 <- data.frame(gene_biotype= c("protein_coding", "lncRNA", "intronic"), counts = c(1, 1, 1))
sample2 <- data.frame(gene_biotype= c("protein_coding", "lncRNA", "intronic"), counts = c(2, 2, 2))
sample3 <- data.frame(gene_biotype= c("protein_coding", "lncRNA", "intronic"), counts = c(3, 3, 3))
sample4 <- data.frame(gene_biotype= c("protein_coding", "lncRNA", "intronic"), counts = c(4, 4, 4))
sapply(paste('sample', seq(1,4,1), sep=''), get, environment(), simplify = FALSE)
}
my.list3 <- list.function()
my.list3
And I want to do these two plots
a = ggplot(sampleX, aes(y=count, x = gene_biotype, fill = gene_biotype)) + geom_bar(stat = "identity") +
xlab("Groups") +
ylab("Counts") +
theme_classic() +
ggtitle(paste0(samplenumber))
b = ggplot(sampleX, aes(y=count, x = gene_biotype, fill = gene_biotype)) + geom_bar(stat = "identity") +
xlab("Groups") +
ylab("Counts") +
theme_classic() +
ggtitle(paste0(samplenumber))
png(samplename, width = 10, height = 5, units = "in", res=200)
ggarrange(a, b)
dev.off()
And then print each graph into a png