Re: [R] call lattice function in a function passing "groups" argument

2008-12-11 Thread Deepayan Sarkar
On Thu, Dec 11, 2008 at 2:55 AM, Thomas Zumbrunn wrote: > I'm trying to use a lattice function within a function and have problems > passing the "groups" argument properly. Let's say I have a data frame > > d <- data.frame(x = rnorm(100), y = c("a", "b")) > > and want to plot variable x in a densi

Re: [R] call lattice function in a function passing

2008-12-11 Thread Ryan Hafen
> > If however I wanted to call the function "densityplot" within a function and > pass the "groups" argument as an argument of that function, how would I have > to proceed? It is not as straightforward as > > f <- function(data, groupvar) { > densityplot(~ x, data, groups = groupvar) > } >

[R] call lattice function in a function passing "groups" argument

2008-12-11 Thread Thomas Zumbrunn
I'm trying to use a lattice function within a function and have problems passing the "groups" argument properly. Let's say I have a data frame d <- data.frame(x = rnorm(100), y = c("a", "b")) and want to plot variable x in a densityplot, grouped by the variable y, then I would do something like