[R-es] error en "dudi.pco"
nuria bs
laptepo en hotmail.com
Jue Ago 20 11:58:52 CEST 2015
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!!!!
library("picante")
library("stringr")
library("ecodist")
library("ade4")
library("ape")
my.xys <- read.table("C:/Filogenia/IN_my.xys.txt",sep="\t",header=T,row.names=1)
my.env <- read.table("C:/Filogenia/IN_my.env.txt",sep="\t",header=T,row.names=1)
my.sample <- read.delim(file="C:/Filogenia/IN_my.sample.txt", sep="\t", header=T,row.names=1)
my.traits <- read.delim("C:/Filogenia/IN_traits_norm.txt",sep="\t",header=T,row.names=1)
stand.value <-apply(my.env, MARGIN=2, max)-apply(my.env, MARGIN=2, min)
stand.envs <-sweep(my.env,2,stand.value,"/")
my.phylo <- read.tree("BCTree_Ports.nwk")
######################################### RLQ #######################################################
# Convertimos el arbol en un arbol de la clase "phylog" gracias a la funcion "newick2phylog()"
# la cual ya incluye la matriz de distancias filogeneticas.
my.phylog <-newick2phylog(write.tree(my.phylo))
# L matrix: COA para my.sample:
COA.sample <- dudi.coa(my.sample,scan=FALSE,nf=dim(my.sample)[2]-1)
# Hacemos un PCA con la matriz de datos geograficos. Esto constituira la mitad de la matriz R.
PCA.xy <- dudi.pca(my.xys,COA.sample$lw,scan=FALSE, nf=dim(my.xys)[1]-1)
# Hacemos un PCA que sera la otra mitad de la matriz R.
PCA.env<- dudi.pca(stand.envs,COA.sample$lw,scale=FALSE, scan=FALSE, nf=dim(stand.envs)[2])
# Hacemos un PCO para los traits:
dist.traits <- dist(my.traits,method="euclidean")
dist.traits<-as.matrix(dist.traits)
# Primera mitad de la matriz Q:
PCO.traits <-dudi.pco(d=dist.traits, row.w=COA.sample$cw,full=TRUE)
Error in dudi.pco(d = dist.traits, row.w = COA.sample$cw, full = TRUE) :
Distance matrix expected
# Segunda mitad de la matriz Q:
PCO.phylo <-dudi.pco(as.dist(as.matrix(my.phylog$Wdist)[names(my.sample),names(my.sample)]),COA.sample$cw,full=TRUE)
# Modificamos las matrices:
source("RLQ.R")
rlq.output <- rlqESLTP(PCA.env,PCA.xy,COA.sample,PCO.traits,PCO.phylo,scan=FALSE,nf=2)
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <https://stat.ethz.ch/pipermail/r-help-es/attachments/20150820/1eaef41e/attachment-0001.html>
------------ próxima parte ------------
An embedded and charset-unspecified text was scrubbed...
Name: IN_my.env.txt
URL: <https://stat.ethz.ch/pipermail/r-help-es/attachments/20150820/1eaef41e/attachment-0004.txt>
------------ próxima parte ------------
An embedded and charset-unspecified text was scrubbed...
Name: IN_my.sample.txt
URL: <https://stat.ethz.ch/pipermail/r-help-es/attachments/20150820/1eaef41e/attachment-0005.txt>
------------ próxima parte ------------
An embedded and charset-unspecified text was scrubbed...
Name: IN_my.xys.txt
URL: <https://stat.ethz.ch/pipermail/r-help-es/attachments/20150820/1eaef41e/attachment-0006.txt>
------------ próxima parte ------------
An embedded and charset-unspecified text was scrubbed...
Name: IN_traits_norm.txt
URL: <https://stat.ethz.ch/pipermail/r-help-es/attachments/20150820/1eaef41e/attachment-0007.txt>
------------ próxima parte ------------
A non-text attachment was scrubbed...
Name: BCTree_Ports.nwk
Type: application/octet-stream
Size: 1171 bytes
Desc: no disponible
URL: <https://stat.ethz.ch/pipermail/r-help-es/attachments/20150820/1eaef41e/attachment-0001.obj>
Más información sobre la lista de distribución R-help-es