[R-es] ERROR: subscript out of bounds

Carlos J. Gil Bellosta cgb en datanalytics.com
Mie Jul 22 15:57:23 CEST 2015


Hola, ¿qué tal?

¿Por qué no ejecutas tu función línea a línea con debug y encuentras dónde
y por qué está el error?

Un saludo,

Carlos J. Gil Bellosta
http://www.datanalytics.com

2015-07-22 10:40 GMT+02:00 nuria bs <laptepo en hotmail.com>:

> Buenas,
>
> Cuando intento ejecutar el siguiente codigo, me aparece el error " Error
> in dist.mat[com.names, com.names] : subscript out of bounds". Porque me
> aparece este error? Y como puedo solucionarlo?
> Gracias!!!
>
> *CONSOLE:*
>
> > 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)
> > sntd.a.function <- function(x){   com.names <- names(x[x > 0])                        # Get de names of the species present in a community   my.com.dist <- dist.mat[com.names, com.names]       # Distance matrix   diag(my.com.dist) = NA                              # Diagonal values to NA -> Matriz sim, diagonal zero   wt.sd(apply(my.com.dist,1,min,na.rm=T), x[x>0])      }
>
> > dist.mat<-cophenetic(my.phylo)> proba<-apply(my.sample, MARGIN = 1, sntd.a.function)
>
> Error in dist.mat[com.names, com.names] : subscript out of bounds
>
>
> _______________________________________________
> R-help-es mailing list
> R-help-es en r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>
>

	[[alternative HTML version deleted]]



Más información sobre la lista de distribución R-help-es