[R] Form Pairs of Variables for a paired t-test

Henrique Dallazuanna wwwhsd at gmail.com
Tue Jan 29 15:15:22 CET 2008


Try this:

lapply(apply(combn(ncol(x),2), 2, function(y)x[,y]),
function(z)t.test(z[,1], z[,2]))

On 29/01/2008, nalluri pratap <pratap_stat at yahoo.co.in> wrote:
> Hi Users,
>
>   This is regarding the paired t-test. I have 5 variables (say) Data$v1,Data$v2,Data$v3,Data$v4,Data$v5 in my data frame. Now, I need to perform a paired t-test on all the possible 10 pairs.How do I set up the pairs table directly and pass those variables in to t-test.
>
>   Thanks in advance,
>
>   Pratap
>
>
> ---------------------------------
>  Now you can chat without downloading messenger. Click here to know how.
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>


-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O



More information about the R-help mailing list