Re: [Rd] Problem using model.frame with argument subset in own function

2009-09-10 Thread Greg B. Hill
Gavin, I ran into the same cryptic "invalid subscript type 'closure'" message in a slightly less complicated scenario, and wanted to post the cause in my case (the root cause is probably the same either way). Similarly to your case, I was subsetting a data frame. I had a list of variable names

Re: [Rd] Problem using model.frame with argument subset in own function

2009-08-09 Thread Gavin Simpson
On Sun, 2009-08-09 at 11:32 -0500, Douglas Bates wrote: > On Sat, Aug 8, 2009 at 1:31 PM, Gavin Simpson wrote: > > Dear List, > > > I am writing a formula method for a function in a package I maintain. I > > want the method to return a data.frame that potentially only contains > > some of the vari

Re: [Rd] Problem using model.frame with argument subset in own function

2009-08-09 Thread Douglas Bates
On Sat, Aug 8, 2009 at 1:31 PM, Gavin Simpson wrote: > Dear List, > I am writing a formula method for a function in a package I maintain. I > want the method to return a data.frame that potentially only contains > some of the variables in 'data', as specified by the formula. The usual way to call

[Rd] Problem using model.frame with argument subset in own function

2009-08-08 Thread Gavin Simpson
Dear List, I am writing a formula method for a function in a package I maintain. I want the method to return a data.frame that potentially only contains some of the variables in 'data', as specified by the formula. The problem I am having is in writing the function and wrapping it around model.fr

Re: [Rd] problem using model.frame()

2005-08-19 Thread Gavin Simpson
On Thu, 2005-08-18 at 09:00 -0400, Gabor Grothendieck wrote: > I think this one is a hard call. Designing software is a > series of tradeoffs. Its nice to maintain consistency with > the R base, but in case of extensions (rather than changing > behavior) as in this case, the argument against the c

Re: [Rd] problem using model.frame()

2005-08-18 Thread Gavin Simpson
On Thu, 2005-08-18 at 07:57 +0300, Jari Oksanen wrote: > On 18 Aug 2005, at 1:49, Gavin Simpson wrote: > > > On Wed, 2005-08-17 at 20:24 +0200, Martin Maechler wrote: > >>> "GS" == Gavin Simpson <[EMAIL PROTECTED]> > >>> on Tue, 16 Aug 2005 18:44:23 +0100 writes: > >> > >> GS> On T

Re: [Rd] problem using model.frame()

2005-08-17 Thread Gavin Simpson
On Wed, 2005-08-17 at 21:48 -0400, Gabor Grothendieck wrote: > If its just a matter of specifying two data frames how about just > letting the user specify them as the first two arguments without > injecting formulas into it so that any of these are allowed but > data frames are still not allowed i

Re: [Rd] problem using model.frame()

2005-08-17 Thread Jari Oksanen
On 18 Aug 2005, at 1:49, Gavin Simpson wrote: > On Wed, 2005-08-17 at 20:24 +0200, Martin Maechler wrote: >>> "GS" == Gavin Simpson <[EMAIL PROTECTED]> >>> on Tue, 16 Aug 2005 18:44:23 +0100 writes: >> >> GS> On Tue, 2005-08-16 at 12:35 -0400, Gabor Grothendieck >> GS> wrote:

Re: [Rd] problem using model.frame()

2005-08-17 Thread Gabor Grothendieck
If its just a matter of specifying two data frames how about just letting the user specify them as the first two arguments without injecting formulas into it so that any of these are allowed but data frames are still not allowed in formulas other than in the data argument: yourfunction(df1, df2) y

Re: [Rd] problem using model.frame()

2005-08-17 Thread Gavin Simpson
On Wed, 2005-08-17 at 20:24 +0200, Martin Maechler wrote: > > "GS" == Gavin Simpson <[EMAIL PROTECTED]> > > on Tue, 16 Aug 2005 18:44:23 +0100 writes: > > GS> On Tue, 2005-08-16 at 12:35 -0400, Gabor Grothendieck > GS> wrote: > >> On 8/16/05, Gavin Simpson <[EMAIL PROTECTED

Re: [Rd] problem using model.frame()

2005-08-17 Thread Martin Maechler
> "GS" == Gavin Simpson <[EMAIL PROTECTED]> > on Tue, 16 Aug 2005 18:44:23 +0100 writes: GS> On Tue, 2005-08-16 at 12:35 -0400, Gabor Grothendieck GS> wrote: >> On 8/16/05, Gavin Simpson <[EMAIL PROTECTED]> >> wrote: > On Tue, 2005-08-16 at 11:25 -0400, Gabor >> Gro

Re: [Rd] problem using model.frame()

2005-08-16 Thread Gavin Simpson
On Tue, 2005-08-16 at 12:35 -0400, Gabor Grothendieck wrote: > On 8/16/05, Gavin Simpson <[EMAIL PROTECTED]> wrote: > > On Tue, 2005-08-16 at 11:25 -0400, Gabor Grothendieck wrote: > > > It can handle data frames like this: > > > > > > model.frame(y1) > > > or > > > model.frame(~., y1)

Re: [Rd] problem using model.frame()

2005-08-16 Thread Gabor Grothendieck
On 8/16/05, Gavin Simpson <[EMAIL PROTECTED]> wrote: > On Tue, 2005-08-16 at 11:25 -0400, Gabor Grothendieck wrote: > > It can handle data frames like this: > > > > model.frame(y1) > > or > > model.frame(~., y1) > > Thanks Gabor, > > Yes, I know that works, but I want the function coc

Re: [Rd] problem using model.frame()

2005-08-16 Thread Gavin Simpson
On Tue, 2005-08-16 at 11:25 -0400, Gabor Grothendieck wrote: > It can handle data frames like this: > > model.frame(y1) > or > model.frame(~., y1) Thanks Gabor, Yes, I know that works, but I want the function coca.formula to accept a formula like this y2 ~ y1, with both y1 and y2 bei

Re: [Rd] problem using model.frame()

2005-08-16 Thread Gabor Grothendieck
It can handle data frames like this: model.frame(y1) or model.frame(~., y1) On 8/16/05, Gavin Simpson <[EMAIL PROTECTED]> wrote: > Hi I'm having a problem with model.frame, encapsulated in this example: > > y1 <- matrix(c(3,1,0,1,0,1,1,0,0,0,1,0,0,0,1,1,0,1,1,1), > n

[Rd] problem using model.frame()

2005-08-16 Thread Gavin Simpson
Hi I'm having a problem with model.frame, encapsulated in this example: y1 <- matrix(c(3,1,0,1,0,1,1,0,0,0,1,0,0,0,1,1,0,1,1,1), nrow = 5, byrow = TRUE) y1 <- as.data.frame(y1) rownames(y1) <- paste("site", 1:5, sep = "") colnames(y1) <- paste("spp", 1:4, sep = "") y1 model.frame(~ y