Hi All:

This may turn out to be very simply, but I can't seem to add the name of
the school to a chart. The loop I created is below that subsets a
dataframe and creates a chart for each school based on certain
variables. As it stands now, they title includes the school's ID number.
Instead, I want to replace this with the school's actual name, which is
stored in a variable called schname.

But so far, my attempts have been messy and ugly? Can anyone see a
mistake in my code?

Thanks,
Harold




#This portion of code takes the subset
school.list<-as.vector(unique(mansfield.dat$schirn))
for(school.number in school.list){
assign(paste("school", school.number, sep=""),
subset(mansfield.dat,mansfield.dat$schirn==school.number))}


for(school.number in school.list){
AV<-mean(get(paste("school",school.number,sep=""))[["bpra3ccf"]])
RP<-mean(get(paste("school",school.number,sep=""))[["bprr3ccf"]])
LT<-mean(get(paste("school",school.number,sep=""))[["bprl3ccf"]])
IT<-mean(get(paste("school",school.number,sep=""))[["bpri3ccf"]])


strengthbar<-cbind(AV,RP,LT,IT)

pdf(paste("school",school.number,"rel", ".pdf",sep=""))
barplot(strengthbar,names=c("AV", "RP", "LT",
"IT"),width=c(.5,.5,.5,.5),ylim = c(0, 4),col=("salmon"))
legend(1.0,3.8,legend=c("1=Relative Weakness", "2=Similar to District",
"3=Relative Strength"))



title(main=(paste("Grade 3 Relative Strengths and Weaknesses", "\n",
"School ", school.number,sep="")))


dev.off()

}

	[[alternative HTML version deleted]]


