[R] Using 'sapply' and 'by' in one function
hadley wickham
h.wickham at gmail.com
Sun Feb 10 16:12:11 CET 2008
On Feb 10, 2008 8:25 AM, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:
> Actually thinking about this, not only do you not need sapply but you
> don't even need by:
>
> new2 <- transform(new, sex = factor(sex))
> coef(lm(as.matrix(new2[1:2]) ~ sex/Pred - 1, new2))
Although that's a very slightly different model, as it assumes that
both sexes have the same error variance.
Hadley
--
http://had.co.nz/
More information about the R-help
mailing list