[R] list of distance matrices

arun smartpink111 at yahoo.com
Sat Apr 6 23:05:22 CEST 2013


Hi,
Try this:
set.seed(25)
 el<-as.data.frame(matrix(sample(1:50,75*124,replace=TRUE),ncol=75))
 lst1<-lapply(el,function(x) dist(x))
 set.seed(28)
 q<-as.data.frame(matrix(sample(1:50,75*124,replace=TRUE),ncol=75))
 q<-dist(q)
library(ade4)
res<- lapply(lst1,function(x) mantel.rtest(q,x,nrepet=9999)
Though, I am getting warnings() for this test (which I am not sure).  
A.K.







----- Original Message -----
From: eliza botto <eliza_botto at hotmail.com>
To: "r-help at r-project.org" <r-help at r-project.org>
Cc: 
Sent: Saturday, April 6, 2013 4:01 PM
Subject: [R] list of distance matrices

Dear UseRs,
i want to apply mantel test by comparing a list of 124 distance matrices with a reference distance matrix "q". The list of distance matrices was created by the following command..
u<-lapply(el, function(x) dist(x))
where "el" is a data frame of 75 columns and 124 rows. Therefore, the list of distances matrices, made out of it should have 75 elements each containing 124 rows and 124 columns.
I, unsuccessfully,  tried the following command 

>mantel.rtest(as.dist(q),  lapply(el, function(x) dist(x)), nrepet = 9999) 
Do you have any clue??
Thanks in advance
Eliza                           
    [[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.




More information about the R-help mailing list