Re: [R] Using 'sapply' and 'by' in one function

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Sun, 10 Feb 2008 10:15:42 -0500

On Feb 10, 2008 10:12 AM, hadley wickham <h.wickham_at_gmail.com> wrote:
> On Feb 10, 2008 8:25 AM, Gabor Grothendieck <ggrothendieck@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.
>

But the output are the coefficients and they are identical.



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sun 10 Feb 2008 - 15:24:13 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 10 Feb 2008 - 18:30:13 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive