In a previous post, I mentioned a loop being used to generate graphs. I have some sample code partially put together but have found one offending line of code that I cannot figure out what to do with.
 
I have one data frame called grade4. If I do something like
 
hist(grade4$math)
 
I get the appropriate chart.
 
Within the loop, however, I am doing this for multiple files and grades, so I use the paste command, but it isn't working. For example, the code would perform something similar to:
 
hist(paste("grade", "4", "$math",sep=""))
 
which doesn't work. The code below is what I hope will ultimately be the working loop.
 
grade.list<-as.vector(unique(egsingle$grade))
for(grade.number in grade.list){
pdf(paste("grade",grade.number,".pdf",sep=""))
hist(paste("grade",grade.number,"$math",sep=""))
dev.off()}
 
I'm a little confused on how to get this work properly. Any thoughts are much appreciated.
 
Harold
 
Windows XP
ver 1.9
 

	[[alternative HTML version deleted]]


