[R] as.matrix() problem in mantel.test()?

Tord Snall tord.snall at ebc.uu.se
Mon May 26 13:54:07 CEST 2003


Dear all,

I get an unexpected error when using the mantel.test function in
library(ape). Is there something wrong with my matrices?

> dmatr<- read.table("obt.Loiselle.kinship.intens02.DIST.matrix.txt",head=F)
> kmatr<-
read.table("obt.Loiselle.kinship.intens02.KINSHIP.matrix.txt",head=F)
> 
> mantel.test(as.matrix(kmatr), as.matrix(dmatr), nperm = 500, graph = T)
Error in var(x, na.rm = na.rm) : `x' is empty
> 
> is.matrix(as.matrix(dmatr))
[1] TRUE
> is.matrix(as.matrix(kmatr))
[1] TRUE
> 
> as.matrix(dmatr[1:5,1:5])
         V1        V2       V3       V4       V5
1        NA   39.9625 223.1820 258.3800 1085.030
2   39.9625        NA 191.3660 224.1090 1084.730
3  223.1820  191.3660       NA  41.8808  972.544
4  258.3800  224.1090  41.8808       NA  981.315
5 1085.0300 1084.7300 972.5440 981.3150       NA
> as.matrix(kmatr[1:5,1:5])
       V1      V2      V3      V4      V5
1      NA -0.0892 -0.3284 -0.0692  0.1895
2 -0.0892      NA  0.1404  0.2367 -0.1888
3 -0.3284  0.1404      NA -0.0025 -0.3629
4 -0.0692  0.2367 -0.0025      NA -0.1689
5  0.1895 -0.1888 -0.3629 -0.1689      NA


Thanks in advance!


Sincerely,
Tord

-----------------------------------------------------------------------
Tord Snäll
Avd. f växtekologi, Evolutionsbiologiskt centrum, Uppsala universitet
Dept. of Plant Ecology, Evolutionary Biology Centre, Uppsala University
Villavägen 14			
SE-752 36 Uppsala, Sweden
Tel: 018-471 28 82 (int +46 18 471 28 82) (work)
Tel: 018-25 71 33 (int +46 18 25 71 33) (home)
Fax: 018-55 34 19 (int +46 18 55 34 19) (work)
E-mail: Tord.Snall at ebc.uu.se
Check this: http://www.vaxtbio.uu.se/resfold/snall.htm!




More information about the R-help mailing list