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)


                                          
LOC     DIAM    TMEAN   PPT     NEIGHBOURS
Preste  207.4583333     7       999     173.0952703
Ports   181.625 11      717     220.7983265
Toran   236.0416667     10      911     235.6761387
LOC     Amblystegium_serpens    Porella_platyphylla     Amblystegium_subtile    
Anomodon_attenuatus     Anomodon_viticulosus    Apometzgeria_pubescens  
Brachythecium_populeum  Brachythecium_velutinum Bryum_moravicum Cf_Hypnum       
Cryphaea_heteromalla    Scleropodium_cespitans  Eurhynchium_sp  Kindbergia 
praelonga    Frullania_tamarisci     Frullania_dilatata      
Homalothecium_sericeum  Hypnum_cupressiforme     HypCupCup       HypCupFil      
Hypnum_recurvatum       Hypnum_revolutum        Isothecium_alopecuroides        
Jungermannia_sp Leptodon_smithii        Leucodon_sciuroides     
Lejeunea_cavifolia      Lophocolea_bidentata    Metzgeria_furcata       
Mnium_stellare  Neckera_besseri Neckera_complanata      Neckera_crispa  
Orthotrichum_affine     Orthotrichum_lyelli     Orthotrichum_speciosum  
Orthotrichum_rupestre   Orthotrichum_sp Orthotrichum_pallens    
Orthotrichum_stramineum Orthotrichum_striatum   Orthotrichum_schimperi  
Orthotrichum_tenellum   Plagiochila_porelloides Plagiothecium_nemorale  
Porella_arboris_vitae   Pseudoleskeella_nervosa Pterigynandrum_filiforme        
Radula_complanata       Rhynchostegiella_curviseta      Thuidium_delicatum      
Ulota_crispa    Tortella_flavovirens    Tortella_tortuosa
Els Ports       0       58      60      0       0       0       0       10      
0       20      8       0       0       0       12      465.5   127     65      
0       65      45      6       0       2       181     0       31      3       
540     0       38.5    2434.5  84      44.5    3       0       0       46.5    
6       5       45      0       0       21.5    0       100     0       82      
180     0       0       0       0       0
La Preste       1       159     0       0       0       12      0       0       
2       0       0       8       15.5    2       0       377     0       23.5    
0       23.5    19      0       1       0       0       6       0       0       
13      0       0       0       0       65      0       76      52      109     
41      0       139.5   21      0       5       0       0       250     159.5   
35.5    0       18      0       2       2.5
Toran   30      701     46      305     148     0       8       6       1.5     
0       0       0       8       0       49      451     491     55      28      
27      102     0       669     0       0       163     1       0       171     
1       0       1052.5  0       5       0       0       13      58.5    0       
25      24      0       3.5     5       30      0       6       504.5   332     
24      0       41.5    0       0
LOC     X       Y
Preste  0448098 4690857
Ports   71135   15801
Toran   20253   43068

Cap     Hid     LonFil  AmpFil  Lfil.Afil       GroLam  GroNer  GroPar  LonCel  
AmpCel  Lcel.Acel       LonSet  LonUrn  AncUrn  Lurn.Aurn       DiamEsp EspCap  
AmbSer  0       0       -0.40346711     -1.62964062     1.2261735       
2.730029        3.164068        0       3.350781        2.115251        
1.2355299       2.8622009       0.55961579      -0.030459207    0.590075        
-4.465408       6.139295
AmbSub  2.897061        2.1563267       -0.70117935     -1.820158944    
1.1189796       2.351375        0       0       3.086487        1.856298        
1.23018865      2.1065702       -0.02020271     -0.653926467    0.63372376      
0       0
AnoAtt  3.720296        0.6562426       0.40546511      -0.430782916    
0.836248        2.74084 3.725693        1.0986123       1.94591 1.969431        
-0.0235212      2.5257286       0.78845736      0       0       -4.465408       0
AnoVit  4.402896        1.8578755       0.69314718      -0.051293294    
0.7444405       5.31812 6.081077        1.686399        4.718499        
4.351567        0.36693144      2.6390573       0.89608802      1.029619417     
-0.13353139     -3.963316       7.033754
ApoPub  4.272178        2.6634819       0       0       0       0       0       
0       3.583519        3.295837        0.28768207      2.1972246       0       
0       0       -3.863233       0
BraPop  3.535268        1.5935488       0.18232156      -0.980829253    
1.1631508       2.268684        3.149883        0       3.94739 2.00148 
1.94591015      2.5649494       0.30010459      0       0       -4.342806       0
BraVel  3.054573        2.5389739       0.09531018      -0.980829253    
1.0761394       2.140066        3.032546        0       4.146304        
1.824549        2.32175501      2.6390573       0.47000363      -0.010050336    
0.48005396      -4.268698       5.873381
BryMor  0       0       0.73620667      -0.271808723    1.0080154       
3.320228        4.077537        0.4054651       4.051785        3.068053        
0.98373201      2.6026897       0.74193734      0       0       -4.53285        0
CryHet  0       0       -0.07796154     -0.693147181    0.6151856       
2.525729        3.48124 0.9162907       2.545531        1.909543        
0.63598877      -1.6873995      0.50077529      -0.278832457    0.77960775      
-3.963316       5.329989
EurStr  3.60081 1.9057978       -0.24079849     -1.757358043    1.5165596       
0       0       0       3.916015        1.818726        2.09728911      0       
1.01038806      0.267734435     0.74265362      -4.074542       6.497394
FruDil  4.277247        0       -0.31197477     -0.544727175    0.2327524       
3.044522        0       0       3.135494        2.75684 0.37865385      0       
-0.32850407     -0.328504067    0       -3.101093       1.468551
FruTam  3.857519        0.7422926       0.40546511      0       0.4054651       
3.48124 0       0.9162907       3.032546        2.70805 0.32449605      0       
0       0       0       -3.036554       0
HomSer  2.96441 2.107062        0.40546511      -1.049822124    1.4552872       
2.079442        2.926739        0       4.174387        1.704748        
2.46963918      2.7080502       0.91629073      0.113328685     0.80296205      
-4.104395       6.278744
HypCupCup       4.285268        1.778071        0.40546511      -0.916290732    
1.3217558       2.251292        0       0       4.248495        1.252763        
2.99573227      2.8622009       0.76546784      -0.061875404    0.82734325      
-3.963316       5.811639
HypCupFil       3.998841        2.5956504       0.18232156      -1.203972804    
1.3862944       2.302585        3.218876        0       4.053957        
1.609438        2.44451859      2.8622009       0.76546784      -0.061875404    
0.82734325      -3.963316       5.811639
HypRec  4.028995        2.9721224       0.43178242      -0.798507696    
1.2302901       2.351375        0       0       3.806662        1.098612        
2.7080502       2.390596        0.67294447      -0.030459207    0.70340368      
-4.50986        6.297075
HypRev  0       0       0.13976194      -0.693147181    0.8329091       0       
0       0       3.465736        1.7492  1.71653605      0.4054651       
0.91629073      -0.061875404    0.97816614      -3.963316       5.962462
IsoAlo  3.557478        2.2494753       0.72658196      -0.053400777    
0.7799827       2.484907        3.465736        0.2231436       3.458522        
1.967112        1.49141009      2.6468838       0.57097955      -0.755022584    
1.32600213      -4.268698       5.229385
KinPra  4.028065        2.585921        0.28668157      -1.164752091    
1.4514337       1.94591 3.091042        0.4054651       3.844547        1.62186 
2.22268641      2.9957323       0.61518564      -0.133531393    0.74871703      
-4.422849       6.049233
LejCav  0       0       -0.28768207     -1.049822124    0.7621401       
2.662588        0       0       3.540959        3.540959        0       0       
0       0       0       0       0
LepSmi  3.658932        1.7789879       -0.597837       -0.916290732    
0.3184537       2.397895        0       0       2.772589        1.609438        
1.16315081      0.4054651       0.81093022      -0.105360516    0.91629073      
-4.045554       5.895854
LeuSci  4.466415        2.357978        0.13976194      -0.798507696    
0.9382696       2.140066        0       0       3.86073 2.047693        
1.81303687      2.1972246       1.09861229      -0.356674944    1.45528723      
-3.688879       5.575547
LopBid  0       0       0.30010459      0.182321557     0.117783        
3.120895        0       0       3.394508        3.135494        0.25901418      
0       0       0       0       -4.045554       0
MetFur  3.906232        1.900518        0       0       0       0       0       
0       3.650658        3.511545        0.1391128       1.6094379       0       
0       0       -3.457768       0
MniSte  0       0       0.81093022      0.336472237     0.474458        
3.075775        4.267364        0.6931472       3.349904        3.277145        
0.07275935      2.5257286       0.55961579      0.3074847       0.25213109      
-3.649659       5.661489
NecBes  3.715617        1.7631646       -0.7985077      -1.203972804    
0.4054651       2.525729        0       0.9162907       2.80336 2.047693        
0.75566754      1.8718022       0.26236426      0       0       -4.045554       0
NecCom  3.610457        2.2061932       0.55961579      -0.798507696    
1.3581235       2.233592        0       0       3.663562        1.832581        
1.83098018      2.3025851       0.37156356      0.009950331     0.36161323      
-3.79424        5.320484
NecCri  3.271841        1.9703652       1.14740245      0.09531018      
1.0520923       1.94591 0       0       4.007333        1.470176        
2.53715734      2.7080502       1.01160091      0.182321557     0.82927936      
-3.688879       6.027532
OrtAff  4.270598        0       1.09861229      -0.223143551    1.3217558       
2.772589        3.64632 0.8472979       2.564949        2.525729        
0.03922071      -0.2876821      0.74193734      -0.076881044    0.81881839      
-3.912023       5.721809
OrtLye  3.944458        2.3168764       1.42310833      -0.162518929    
1.5856273       3.113515        3.749504        1.4663371       2.674149        
2.484907        0.189242        0.1823216       0.85441533      -0.634878272    
1.4892936       -3.611918       4.976185
OrtPal  3.74284 0       0.93609336      -0.510825624    1.446919        
3.191847        3.912023        1.3862944       2.639057        2.442347        
0.19671029      -0.4307829      0.69314718      -0.133531393    0.82667857      
-4.268698       5.973044
OrtRup  4.052565        0       1.16315081      -0.162518929    1.3256697       
2.662588        3.776585        0.8472979       2.525729        2.140066        
0.38566248      -0.2231436      0.58778666      0.231111721     0.35667494      
-4.074542       6.03817
OrtSpe  0       0       1.23837423      -0.162518929    1.4008932       
2.793208        3.84303 1.2039728       2.772589        2.525729        
0.24686008      0.5596158       0.71783979      -0.235722334    0.95356213      
-4.074542       5.701389
OrtStra 3.944813        2.1249422       0.85441533      -0.510825624    
1.365241        2.961831        3.526361        1.299283        2.397895        
2.251292        0.14660347      -0.1625189      0.61518564      -0.051293294    
0.66647893      -4.342806       6.051428
OrtStri 4.374029        1.5804326       1.14740245      -0.430782916    
1.5781854       3.245193        3.850148        1.2039728       2.639057        
2.302585        0.33647224      -0.5108256      0.55961579      -0.0965109      
0.65612669      -3.611918       5.219753
OrtTen  3.980491        2.0392373       0.87546874      -0.287682072    
1.1631508       0       0       0       2.525729        2.442347        
0.08338161      -0.5108256      0.61518564      -0.223143551    0.83832919      
-4.233607       5.770379
PlaNem  0       0       0.97644465      -0.005012542    0.9814572       
3.918668        3.164068        0       4.78096 2.949361        1.83159898      
0       1.10955223      0.101653654     1.00789857      -4.422849       6.778784
PlaPor  4.248758        0       0.61518564      0.500775288     0.1144104       
3.258097        0       0.4054651       3.442019        3.526361        
-0.08434115     0.5596158       0       0       0       -4.074542       0
PorArbVit       0       0.7303954       0.66782937      0.405465108     
0.2623643       3.091042        0       0       3.456317        3.258097        
0.19822014      -0.8556661      0       0       0       -2.956512       0
PorPla  4.026981        2.0049721       0.69314718      0.371563556     
0.3215836       3.283414        0       0.4054651       3.422837        
3.147648        0.27518824      -0.8556661      0       0       0       
-2.956512       0
PseNer  3.851398        1.835751        -0.20456717     -1.216551587    
1.0119844       2.61496 3.564827        0       2.374906        1.974515        
0.40039079      3.2188758       0.69314718      -0.324346057    1.01749324      
-4.135167       5.648698
PteFil  -1.065371       0.6051899       -0.43386458     -1.276543497    
0.8426789       2.159484        0       0       3.269569        1.609438        
1.66013103      2.3025851       0.55961579      -0.371063681    0.93067947      
-4.422849       5.756131
RadCom  4.039162        1.5935775       0.30010459      0.113328685     
0.1867759       3.113515        0       0.9162907       3.637586        
2.904165        0.73342108      0       -0.28768207     -0.356674944    
0.06899287      -3.506558       1.789503
RhyCur  4.01937 2.1648167       0.04305949      -1.027222293    1.0702818       
2.302585        2.995732        0.9162907       3.532226        1.734601        
1.79762459      0       0.30010459      -0.186329578    0.48643417      
-4.233607       5.492112
SclCes  0       0       0.18232156      -0.597837001    0.7801586       
2.302585        0       0       3.871201        1.791759        2.07944154      
2.4849066       0       0       0       -4.017384       0
ThuDel  3.782073        1.8466119       -1.2039728      -1.673976434    
0.4700036       2.944439        2.224624        1.0986123       2.270836        
1.983154        0.28768207      3.4011974       1.06471074      -0.223143551    
1.28785429      -4.017384       6.003681
TorFlaFla       0       0       0.91629073      -0.597837001    1.5141277       
2.862201        4.007333        1.3217558       2.374906        2.251292        
0.12361396      2.6026897       0.69314718      -0.549913012    1.24306019      
-4.382027       5.669991
TorTor  0       0       1.5040774       -0.597837001    2.1019144       
3.314186        4.007333        2.1690537       2.224624        2.140066        
0.08455739      2.944439        0.81093022      -0.119346758    0.93027697      
-4.50986        6.346173
UloCri  3.632599        1.3500452       0.99325177      -0.510825624    
1.5040774       2.302585        3.533687        0.6931472       2.525729        
2.351375        0.17435339      0.7884574                                       

Attachment: BCTree_Ports.nwk
Description: Binary data

_______________________________________________
R-help-es mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-help-es

Responder a