[R] Generating automatic plots
Jason Turner
jasont at indigoindustrial.co.nz
Wed Oct 8 12:43:17 CEST 2003
Xavier Fernández i Marín wrote:
...
>>varlist <- c("var1", "var2", "var3", "var4", ...)
Instead of a character vector with the names, it'd make life easier if
you had a list of the vectors...
# make sure you use the naming - makes life easier later.
mylist <- list(var1=var1, var2=var2, var3=var3, var4=var4)
Then...
for(i in seq(along=mylist)) { # seq(along=...) is safest.
jpeg(names(mylist)[i], width=...)
boxplot(mylist[[i]] ~ missing, xlab=...)
dev.off() # you didn't have this. it's required.
}
# but I don't see how "missing" gets correctly passed in your example,
# so I'm not sure what it's supposed to do.
> I suppose that is because I forget something related to the extraction of
> values in vectors, but I can't find it on the R manual neither in other books
> about R that I have checked.
Nope. It's about passing a strings of text to plot, instead of actual
data. You'd have to actually parse the string to produce the value.
And that's getting tricky (at least, it's tricky to my brain). The
above is pretty simple by comparison.
Cheers
Jason
--
Indigo Industrial Controls Ltd.
http://www.indigoindustrial.co.nz
64-21-343-545
jasont at indigoindustrial.co.nz
More information about the R-help
mailing list