Re: [Rd] model.matrix evaluation challenges

2009-08-11 Thread Ben Bolker
that seems to work, thank you. would anyone care to explain *why* it works ... ? or where I could go to read more about why it works ... ? cheers Ben Bolker Felix Andrews wrote: how about... nrow(with(cc, model.matrix(params, data=environment( cheers -Felix 2009/8/10

Re: [Rd] model.matrix evaluation challenges

2009-08-11 Thread Felix Andrews
Hi, OK, yes, it does require some explanation... What is the difference between your examples 2 and 3, where the first has the formula given explicitly, and the second has the formula assigned to the object? As you said, case 2 works while case 3 fails. 2.

Re: [Rd] model.matrix evaluation challenges

2009-08-10 Thread Felix Andrews
how about... nrow(with(cc, model.matrix(params, data=environment( cheers -Felix 2009/8/10 Ben Bolker bol...@ufl.edu:  I am having difficulty with evaluation/environment construction for a formula to be evaluated by model.matrix().  Basically, I want to construct a model matrix that first

[Rd] model.matrix evaluation challenges

2009-08-09 Thread Ben Bolker
I am having difficulty with evaluation/environment construction for a formula to be evaluated by model.matrix(). Basically, I want to construct a model matrix that first looks in newdata for the values of the model parameters, then in obj...@data. Here's what I've tried: 1.