I'm trying to cycle through a list of Seurat objects and make violin plots of each object. My code is:
for (i in 1:length(gene.list)){
VlnPlot(gene.list[[i]], features = c("nCount_RNA", "nFeature_RNA", "percent.mt"))
}
but no plots are being produced. To test my code I did a single line:
VlnPlot(gene.list[[2]], features = c("nCount_RNA", "nFeature_RNA", "percent.mt"))
And the desired plot was generated, so it must be something with my loop, right?
I tried doing:
VlnPlot(gene.list[[as.integer(i)]], features = c("nCount_RNA", "nFeature_RNA", "percent.mt"))
}
But that didn't make a difference.
Any ideas?
Thanks,