nuria
2015-Jul-27 18:01 UTC
[R] Error in dist.mat[com.names, com.names] : subscript out of bounds
Hi! I want to estimate the phylogenetic diversity. I use the SDMTools package. In the line 3 of the "sntd.a" function appears this error and I don't know the reason. my.phylo<-read.tree("150_BootstrapConsensusTree_Cantabrian_ML.nwk") my.sample <- read.delim("C:/Filogenia/my.sample.txt") my.sample<-read.table("my.sample.txt",sep="\t", header=T, row.names=1) library(SDMTools) dist.mat<-cophenetic(my.phylo) sntd.a.function <- function(x){ com.names <- names(x[x > 0]) my.com.dist <- dist.mat[com.names, com.names] diag(my.com.dist) = NA wt.sd(apply(my.com.dist,1,min,na.rm=T), x[x>0]) } result<-apply(my.sample, MARGIN = 1, sntd.a.function) Error in dist.mat[com.names, com.names] : subscript out of bounds Called from: FUN(newX[, i], ...) Browse[1]> 150_BootstrapConsensusTree_Cantabrian_ML.nwk <http://r.789695.n4.nabble.com/file/n4710412/150_BootstrapConsensusTree_Cantabrian_ML.nwk> my.txt <http://r.789695.n4.nabble.com/file/n4710412/my.txt> Thanks!!!! -- View this message in context: http://r.789695.n4.nabble.com/Error-in-dist-mat-com-names-com-names-subscript-out-of-bounds-tp4710412.html Sent from the R help mailing list archive at Nabble.com.