Thanks, that completely solves the problem.
On Sep 22, 2009, at 10:27 PM, Gabor Grothendieck wrote:
Try parse(text=...):
f <- function(fo, data, groups) {
g <- do.call("xyplot", list(as.formula(fo),
groups = parse(text = groups), data))
print(g)
}
f("yield ~ variety | site", data = barley, groups = "year")
On Tue, Sep 22, 2009 at 4:20 PM, Erich Neuwirth
<erich.neuwi...@univie.ac.at> wrote:
Thank you, this works for my example.
On Sep 22, 2009, at 9:17 PM, Gabor Grothendieck wrote:
f <- function(fo, data, groups) {
g <- do.call("xyplot", list(as.formula(fo), groups = as.name
(groups), data))
print(g)
}
But xyplot allows expressions for the groups parameter also,
and using as.expression instead of as.name in your example does not
work.
What is happening?
f <- function(fo, data, groups) {
g <- do.call("xyplot", list(as.formula(fo), groups = as.expression
(groups),
data))
print(g)
}
f("yield ~ variety ~ site",barley,"year")
produces a very nicely labeled but empty plot.
______________________________________________
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.