[R] Looped t.test results according to a subset variable
Julian Burgos
jmburgos at u.washington.edu
Tue Oct 23 00:41:10 CEST 2007
See by()
Matthew Dubins wrote:
> Hi all,
>
> I wrote a simple function that gives me multiple t.test results
> according to a subset variable and am wondering whether or not I
> reinvented the wheel. Observe:
>
> t.test.sub <- function (formula, data, sub, ...)
> {
> for(i in 1:max(sub))
> {
> print(t.test(formula, data = subset(data, sub == i), ...))
> }
> }
>
> Is there already a similar function in some package?
>
> Thanks,
> Matthew Dubins
>
> ______________________________________________
> 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.
More information about the R-help
mailing list