Re: [R] Plotting graphs using FOR loop

2009-11-17 Thread Tal Galili
How about: for(i in c(16,24,32,40)) { par(mfrow=c(2,4)) for(j in c(i:(i+7)) { 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() } -- My contact information: Tal

[R] Plotting graphs using FOR loop

2009-11-16 Thread ychu066
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)