<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! Estoy intentando hacer un script que me permita integrar la información filogenetica, funcional, ambiental y espacial para saber si hay filtrado ambiental en mis comunidades. Aunque el script creo que esta bien hecho, me sale un error que no puedo solucionar y no se porque me aparece. Alguien podría darme alguna idea? Gracias!!!!<br><br><br>library("picante")<br>library("stringr")<br>library("ecodist")<br>library("ade4")<br>library("ape")<br><br><pre tabindex="0" class="GEM3DMTCFGB" id="rstudio_console_output" style="font-family: 'Lucida Console'; font-size: 10pt !important; outline: none; border: none; word-break: break-all; margin: 0px; -webkit-user-select: text; white-space: pre-wrap !important; line-height: 15px; color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: -webkit-left; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><span class="GEM3DMTCLGB ace_keyword" style="color: blue; white-space: pre; -webkit-user-select: text;"></span>my.xys <- read.table("C:/Filogenia/IN_my.xys.txt",sep="\t",header=T,row.names=1)<br>my.env <- read.table("C:/Filogenia/IN_my.env.txt",sep="\t",header=T,row.names=1)<br>my.sample <- read.delim(file="C:/Filogenia/IN_my.sample.txt", sep="\t", header=T,row.names=1)<br>my.traits <- read.delim("C:/Filogenia/IN_traits_norm.txt",sep="\t",header=T,row.names=1)<br><br>stand.value <-apply(my.env, MARGIN=2, max)-apply(my.env, MARGIN=2, min)<br>stand.envs <-sweep(my.env,2,stand.value,"/")<br><br>my.phylo <- read.tree("BCTree_Ports.nwk")<br><br>######################################### RLQ #######################################################<br># Convertimos el arbol en un arbol de la clase "phylog" gracias a la funcion "newick2phylog()" <br># la cual ya incluye la matriz de distancias filogeneticas. <br>my.phylog <-newick2phylog(write.tree(my.phylo))<br><br># L matrix: COA para my.sample:<br>COA.sample <- dudi.coa(my.sample,scan=FALSE,nf=dim(my.sample)[2]-1)<br><br># Hacemos un PCA con la matriz de datos geograficos. Esto constituira la mitad de la matriz R.<br>PCA.xy <- dudi.pca(my.xys,COA.sample$lw,scan=FALSE, nf=dim(my.xys)[1]-1)<br><br># Hacemos un PCA que sera la otra mitad de la matriz R.<br>PCA.env<- dudi.pca(stand.envs,COA.sample$lw,scale=FALSE, scan=FALSE, nf=dim(stand.envs)[2])<br><br># Hacemos un PCO para los traits:<br>dist.traits <- dist(my.traits,method="euclidean")<br>dist.traits<-as.matrix(dist.traits)<br><br># Primera mitad de la matriz Q:<br>PCO.traits <-dudi.pco(d=dist.traits, row.w=COA.sample$cw,full=TRUE)<span class="GEM3DMTCLFB ace_keyword" style="color: blue;">
</span><span class="GEM3DMTCPFB  ace_constant" style="color: rgb(197, 6, 11);">Error in dudi.pco(d = dist.traits, row.w = COA.sample$cw, full = TRUE) : 
  Distance matrix expected</span></pre><br># Segunda mitad de la matriz Q:<br>PCO.phylo <-dudi.pco(as.dist(as.matrix(my.phylog$Wdist)[names(my.sample),names(my.sample)]),COA.sample$cw,full=TRUE)<br><br># Modificamos las matrices:<br>source("RLQ.R")<br>rlq.output <- rlqESLTP(PCA.env,PCA.xy,COA.sample,PCO.traits,PCO.phylo,scan=FALSE,nf=2)<br><br><br>                                          </div></body>
</html>