Dear List:

I have a large dataset of multiple schools. My goal is to produce a
separate tex file for each school that plots some of the student
achievement scores. Essentially, the aim is to develop a custom report
for each school. To accomplish this, I have code for a loop that gets
sourced into R and then Sweaves the multiple files to create the
individual school reports.

Here is the code for the loop

schnum.list <- as.vector(unique(cmu$schid))

for(current.school in schnum.list) {
    school.df <- subset(cmu, cmu$schid==current.school)
    school.grades <- as.vector(unique(school.df$grade))

        sname <- paste(paste("read", current.school,
sep=""),"Rnw",sep=".")
        system(paste("schoolread.Rnw", paste("Reading/", sname, sep=""),
sep=" "))
        Sweave(file= paste("Reading/", sname, sep=""))
}


However, this begins to work and then produces the following errors

Writing to file read151-496-2982.tex
Processing code chunks ...
Error in file(con, "r") : unable to open connection
In addition: Warning messages: 
1: Impossible to run 'G:\SWEAVE~1\SCHOOL~2.RNW
Reading/read151-496-2982.Rnw 
2: cannot open file `Reading/read151-496-2982.Rnw' 

I'm not sure exactly what the impossible to run error is. I think this
is on the verge of running correctly, but could use a little help.

Thanks,

Harold

Ver 1.9.0, Windows XP

	[[alternative HTML version deleted]]


