Skip to content
Prev 200089 / 398503 Next

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

Thread (12 messages)

ychu066 Plotting Histogram using histogram() and for loop and I want to save the histogram individually ... HELP Nov 12 Karl Ove Hufthammer Plotting Histogram using histogram() and for loop and I want to save the histogram individually ... HELP Nov 13 ychu066 Plotting Histogram using histogram() and for loop and I want to save the histogram individually ... HELP Nov 16 ychu066 Plotting Histogram using histogram() and for loop and I want to save the histogram individually ... HELP Nov 16 ychu066 Plotting Histogram using histogram() and for loop and I want to save the histogram individually ... HELP Nov 16 Karl Ove Hufthammer Plotting Histogram using histogram() and for loop and I want to save the histogram individually ... HELP Nov 16 Tal Galili Plotting Histogram using histogram() and for loop and I want to save the histogram individually ... HELP Nov 17 Colin Millar Plotting Histogram using histogram() and for loop and Iwant to save the histogram individually ... HELP Nov 17 ychu066 Plotting Histogram using histogram() and for loop and Iwant to save the histogram individually ... HELP Nov 17 David Winsemius Plotting Histogram using histogram() and for loop and I want to save the histogram individually ... HELP Nov 17 ychu066 Plotting Histogram using histogram() and for loop and Iwant to save the histogram individually ... HELP Nov 17 Tal Galili Plotting Histogram using histogram() and for loop and Iwant to save the histogram individually ... HELP Nov 18