ychu066
2009-Nov-13 03:10 UTC
[R] Plotting Histogram using histogram() and for loop and I want to save the histogram individually ... HELP
I am trying to write R codes for the histogram plot and saving it out. There will be 146 histogram plots in total?. I have the following R codes that draws the each Histogram ?. library(lattice) for(i in 8:153){ histogram(~ data[,i] | data[,2], data=data,,ylab="Frequency",xlim=c(1,5),xlab="Score",ylim=c(0,100)),main=paste(colnames(data)[i],sep="") } And I also want to save each histogram in each separate pdf file using the following codes ?. png("hist.png[i]") dev.off() But my R coding does NOT work ?. I need someone to help me with this ??. Thanks million -- View this message in context: http://old.nabble.com/Plotting-Histogram-using-histogram%28%29-and-for-loop-and-I-want-to-save-the-histogram-individually-...-HELP-tp26328734p26328734.html Sent from the R help mailing list archive at Nabble.com.
Karl Ove Hufthammer
2009-Nov-13 08:18 UTC
[R] Plotting Histogram using histogram() and for loop and I want to save the histogram individually ... HELP
On Thu, 12 Nov 2009 19:10:52 -0800 (PST) ychu066 <ychu066 @aucklanduni.ac.nz> wrote:> And I also want to save each histogram in each separate pdf file using the > following codes ?. > png("hist.png[i]") > dev.off()Try png(paste("hist",i,".png",sep="") instead. -- Karl Ove Hufthammer
ychu066
2009-Nov-17 03:36 UTC
[R] Plotting Histogram using histogram() and for loop and I want to save the histogram individually ... HELP
still doesnt work ... Karl Ove Hufthammer wrote:> > On Thu, 12 Nov 2009 19:10:52 -0800 (PST) ychu066 <ychu066 > @aucklanduni.ac.nz> wrote: >> And I also want to save each histogram in each separate pdf file using >> the >> following codes ?. >> png("hist.png[i]") >> dev.off() > > Try png(paste("hist",i,".png",sep="") instead. > > -- > Karl Ove Hufthammer > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > >-- View this message in context: http://old.nabble.com/Plotting-Histogram-using-histogram%28%29-and-for-loop-and-I-want-to-save-the-histogram-individually-...-HELP-tp26328734p26383915.html Sent from the R help mailing list archive at Nabble.com.