Skip to content
Prev 310411 / 398506 Next

Help with lme

On Fri, Nov 9, 2012 at 5:27 PM, Bert Gunter <gunter.berton at gene.com> wrote:
Seconding Bert's advice to repost to R-SIG-Mixed-models (it's a great
mailing list with brilliant statisticians) and commending a really
good reproducible example. The only thing I'd note is that you
generally don't want to use constructs like:

data.frame(cbind(....))

cbind() will create a matrix object before data.frame() is called. The
disadvantage of that is that a matrix can have only one sort of data,
so cbind() will force it all to be the same (usually either numeric or
character). You can loose information here, but, more importantly
data.frame() doesn't know what went into cbind() so it doesn't bother
to convert back to the original data type. Then you're left with a
data.frame of all one data type, which more or less defeats the point
of data.frames in the first place. :-)

It's better to just call data.frame() directly with something like

data.frame(subject, treatment, day, replicate, outcome)

You'll also get the added bonus of R figuring out names for columns here.

Of course, in your case, it doesn't hurt because your data really is
all of the same type. But good practice and all that!

Cheers and welcome!

Michael