On 26/08/2009, at 3:08 PM, Donald Braman wrote:

This is a simple problem that has stumped me: I'm trying to loop through a few dozen variable names in graphs. I've tried various approaches like
this:
attach(mydata)
ivs <- c("oneiv", "anotheriv", "yetanotheriv")
dvs <- c("onedv", "anotherdv", "yetanotherdv")
for (iv in ivs) {
for (dv in dvs) {
graphname <- paste(iv, dv, ".png", sep = "")
png(file=graphname, width=300, height=300)
plot(dv ~ iv, pch=".")
lines(loess.smooth(iv, dv), lty=1)
dev.off()
}
}

Clearly that doesn't work. I'm not sure how to make R see the iv and dv
strings as variables.  Advice?

?get

        cheers,

                Rolf Turner

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to