[R] Using perm.t.test() upon Matrix/Dataframe columns parted by factor instead of t.test()

Gunnar Oehmichen oehm8895 at uni-landau.de
Fri Jul 29 12:30:57 CEST 2011

Hello dear subscribed Users,

this is my first post, so please forgive me for any inconveniences.

The following problem: I have a dataframe containing a factor column.
For each column i would like to compare means as parted by the factor. 
Using the normal t.test function I have already achieved my goal. But i 
think, that for my original data, a permutational t.test would be better 
suited. Herein lies the problem. Whereas i can specify the factor as 
group parting in the formular expression I am not able to do this with 
perm.t.test() from deducer. Have fun with this trivial undergraduate 


c(rep("A", 5), rep("B", 5))->Faktor

matrix(rnorm(100, mean=20, sd=4), nrow=10, ncol=10)->M

colnames(M) <- c("species1","species2", 

###Conventional T-Test to test for differences of each species per factor

   M, function(x)
   t.test(x~ Faktor)

###Trying it for perm.t.test without the helpful formular expression. 
Does not work

   M, function(x)
   perm.t.test(subset(M, Faktor=="A"),
               subset(M, Faktor=="B"))

Thank you very much for your help,


More information about the R-help mailing list