Let us walk through my problem step by step:
1.
print(xyplot(yield ~ variety | site,groups=year,data=barley))
2.
print(xyplot(as.formula("yield ~ variety |
site"),groups=year,data=barley))
The above two statements work, the next one does not work
3.
print(xyplot(as.formula("yield ~ variety |
On Tue, Sep 22, 2009 at 12:03 PM, Erich Neuwirth
wrote:
> I need to play games with an expression similar to the following one:
>
> print(xyplot(DepVar ~ Group|Covar, groups=Othergroup,
> data=mydf, pch = 18 ,main="Testcase",auto.key = TRUE))
>
>
> The problem is that the formula argument
Can't you just use get()? What am I missing?
f <- function(fo, data, groups) {
g <- xyplot(as.formula(fo), groups = get(groups), data)
print(g)
}
f("yield ~ variety | site", data = barley, groups = "year")
Peter Ehlers
Erich Neuwirth wrote:
Thanks, that completely solves the
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 ~ va
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
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 a
Try this:
f <- function(fo, data, groups) {
g <- do.call("xyplot", list(as.formula(fo), groups = as.name(groups),
data))
print(g)
}
f("yield ~ variety | site", data = barley, groups = "year")
On Tue, Sep 22, 2009 at 3:03 PM, Erich Neuwirth
wrote:
> I need to play games with a
I need to play games with an expression similar to the following one:
print(xyplot(DepVar ~ Group|Covar, groups=Othergroup,
data=mydf, pch = 18 ,main="Testcase",auto.key = TRUE))
The problem is that the formula argument (the first argument)
an the groups argument are passed over from a
8 matches
Mail list logo