I am trying to create heatmaps using RStudio in a for loop. I would like to save it in the folder directly rather than displaying the graphs in the plots window. I want to know how to do this inside a loop.
This is the code I tried so far> a[[i]] is dataframe containing the values to be plotted
setwd("/home/coolgal2k/output/heatmaps/")
hm = NULL
for (i in 1:100){
hm.900[[i]] <- heatmap.2(a[[i]],
dendrogram="none", Rowv=F,Colv=F,
col=bluered(256), scale="none", key=T,
density.info="none", main=paste0("Heatmap of Z-scores","[[i]])",
cexRow=0.7, cexCol=0.7, trace="none", symm=F, symbreaks=T, symkey=T)
dev.off()
}
When I try to do this:
I get error saying that unexpected "}" in: I checked for all formatting in the code, it is fine!
Please help!