<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Buenas, <br><br>Cuando intento ejecutar el siguiente codigo, me aparece el error " <span class="GCG2UJHDIAB  ace_constant" style="color: rgb(197, 6, 11); ">Error in dist.mat[com.names, com.names] : subscript out of bounds". <font style="" color="#000000">Porque me aparece este error? Y como puedo solucionarlo? <br>Gracias!!!<br><br><b>CONSOLE:</b><br></font></span><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Lucida Console'; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 15px; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: rgb(225, 226, 229); "><pre tabindex="0" class="GCG2UJHDNAB" style="font-family: 'Lucida Console'; font-size: 10pt !important; outline-style: none; outline-width: initial; outline-color: initial; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; white-space: pre-wrap !important; word-break: break-all; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; -webkit-user-select: text; line-height: 1.2; "><span class="GCG2UJHDABB ace_keyword" style="white-space: pre; -webkit-user-select: text; color: blue; ">> </span><span class="GCG2UJHDEAB ace_keyword" style="color: blue; ">my.phylo<-read.tree("150_BootstrapConsensusTree_Cantabrian_ML.nwk")
</span><span class="GCG2UJHDABB ace_keyword" style="white-space: pre; -webkit-user-select: text; color: blue; ">> </span><span class="GCG2UJHDEAB ace_keyword" style="color: blue; ">my.sample <- read.delim("C:/Filogenia/my.sample.txt")
</span><span class="GCG2UJHDABB ace_keyword" style="white-space: pre; -webkit-user-select: text; color: blue; ">> </span><span class="GCG2UJHDEAB ace_keyword" style="color: blue; ">my.sample<-read.table("my.sample.txt",sep="\t", header=T, row.names=1)<br><br></span><span class="GCG2UJHDABB ace_keyword" style="white-space: pre; -webkit-user-select: text; color: blue; ">> </span><span class="GCG2UJHDEAB ace_keyword" style="color: blue; ">library(SDMTools)
</span><span class="GCG2UJHDABB ace_keyword" style="white-space: pre; -webkit-user-select: text; color: blue; "><br>> </span><span class="GCG2UJHDEAB ace_keyword" style="color: blue; ">sntd.a.function <- function(x){
</span><span class="GCG2UJHDABB ace_keyword" style="white-space: pre; -webkit-user-select: text; color: blue; "> </span><span class="GCG2UJHDEAB ace_keyword" style="color: blue; ">  com.names <- names(x[x > 0])                        # Get de names of the species present in a community
</span><span class="GCG2UJHDABB ace_keyword" style="white-space: pre; -webkit-user-select: text; color: blue; "> </span><span class="GCG2UJHDEAB ace_keyword" style="color: blue; ">  my.com.dist <- dist.mat[com.names, com.names]       # Distance matrix
</span><span class="GCG2UJHDABB ace_keyword" style="white-space: pre; -webkit-user-select: text; color: blue; "> </span><span class="GCG2UJHDEAB ace_keyword" style="color: blue; ">  diag(my.com.dist) = NA                              # Diagonal values to NA -> Matriz sim, diagonal zero
</span><span class="GCG2UJHDABB ace_keyword" style="white-space: pre; -webkit-user-select: text; color: blue; "> </span><span class="GCG2UJHDEAB ace_keyword" style="color: blue; ">  wt.sd(apply(my.com.dist,1,min,na.rm=T), x[x>0])     
</span><span class="GCG2UJHDABB ace_keyword" style="white-space: pre; -webkit-user-select: text; color: blue; "> </span><span class="GCG2UJHDEAB ace_keyword" style="color: blue; ">}<br><br></span><span class="GCG2UJHDABB ace_keyword" style="white-space: pre; -webkit-user-select: text; color: blue; ">> </span><span class="GCG2UJHDEAB ace_keyword" style="color: blue; ">dist.mat<-cophenetic(my.phylo)
</span><span class="GCG2UJHDABB ace_keyword" style="white-space: pre; -webkit-user-select: text; color: blue; ">> </span><span class="GCG2UJHDEAB ace_keyword" style="color: blue; ">proba<-apply(my.sample, MARGIN = 1, sntd.a.function)<br><br></span><span class="GCG2UJHDIAB  ace_constant" style="color: rgb(197, 6, 11); ">Error in dist.mat[com.names, com.names] : subscript out of bounds</span></pre></span><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Lucida Console'; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 15px; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: rgb(225, 226, 229); "></span>                                      </div></body>
</html>