I have the following codes but can anyone make it shorter i.e making these
FOR loop into one loop ...
thanks...

par(mfrow=c(2,4))                 
for(i in 16:23){
hist(data[,i],main=paste(colnames(data)[i],sep=""),ylab="Frequency",xlim=c(1,5),xlab="Score",ylim=c(0,100))
 
}   
png("histogram.png")
dev.off() 

par(mfrow=c(2,4))                 
for(i in 24:31){
hist(data[,i],main=paste(colnames(data)[i],sep=""),ylab="Frequency",xlim=c(1,5),xlab="Score",ylim=c(0,100))
 
} 
png("histogram.png")
dev.off() 

par(mfrow=c(2,4))                 
for(i in 32:39){
hist(data[,i],main=paste(colnames(data)[i],sep=""),ylab="Frequency",xlim=c(1,5),xlab="Score",ylim=c(0,100))
 
} 
png("histogram.png")
dev.off() 

par(mfrow=c(2,4))                 
for(i in 40:47){
hist(data[,i],main=paste(colnames(data)[i],sep=""),ylab="Frequency",xlim=c(1,5),xlab="Score",ylim=c(0,100))
 
} 
png("histogram.png")
dev.off() 


-- 
View this message in context: 
http://old.nabble.com/Plotting-graphs-using-FOR-loop-tp26383926p26383926.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@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.

Reply via email to