I'm trying to generate multiple plots using a lattice command, as follows:
variable <- (string with variable names)
for (i in 1:X){
mypath <- paste(i,' - ',variable[i],'.png',sep='')
png(mypath,width=760)
xyplot(get(variable[i]) ~ GroupVariable, groups = IDvariable,
data = dataset,
type = "l" )
dev.off()
}
The problem is, although the individual piece of code works fine, when executing the for loop the files are generated without any plot. The code works fine with other plots not generated by lattice. Does anyone know how to fix this?
Regards, David
print(xyplot(...))
. – Johan Larsson