Hi Juan,

There is a bug in pcoa() when only one axis is selected by the function. You 
can fix it by editing the function with fix(pcoa) and modify line 38 (or close 
depending on how the editor arranges the lines of code):

vectors <- sweep(D.eig$vectors[, 1:k], 2, sqrt(eig[1:k]), FUN = "*")

insert ', drop = FALSE' where D.eig$vectoes is indexed so this line becomes:

vectors <- sweep(D.eig$vectors[, 1:k, drop = FALSE], 2, sqrt(eig[1:k]), FUN = 
"*")

save and close. There are two other similar lines but they are not used in your 
example. I've fixed that in ape 5.5 (which should be on CRAN soon).

As a side note, it took me some time to figure out the shape of the data you 
posted. Mail applications sometimes format lines of text in different ways, so 
it's better to run a command like this:

cat(deparse(DH), sep = "\n")

and paste the output in your message. This can then be input with: DH <- [[the 
output from above]] with the attributes correctly set.

Best,

Emmanuel

----- Le 23 Avr 21, à 21:24, Juan Antonio Balbuena j.a.balbu...@uv.es a écrit :

> Hellow,
> 
> I am running a set of simulations with distance matrices used as input
> to pcoa (package ape).
> 
> In one instance the matrix (DH) is
> 
> H18 H20 H21 H18 0.0000000 0.3127452190 0.3127452190 H20 0.3127452
> 0.0000000000 0.0001625185 H21 0.3127452 0.0001625185 0.0000000000
> 
> when I run pcoa I get this
> 
> H.PCo <- pcoa(DH, correction="none")$vectors Error in array(STATS,
> dims[perm]) : 'dims' cannot be of length 0
> 
> However, if I multiply DH*10 pcoa runs just fine:
> 
> H.PCo <- pcoa(DH*10, correction="none")$vectors
> 
> A word of explanation will be very much appreciated.
> 
> Thank you for your attention
>  
> Juan A. Balbuena
> 
> --
> 
> Dr. Juan A. Balbuena
> Cavanilles Institute of Biodiversity and Evolutionary Biology
> Symbiont Ecology and Evolution Lab
> University of Valencia http://www.uv.es/~balbuena
> <http://www.uv.es/%7Ebalbuena>
> P.O. Box 22085 http://www.uv.es/cophylpaco <http://www.uv.es/cophylpaco>
> 46071 Valencia, Spain
> e-mail: j.a.balbu...@uv.es <mailto:j.a.balbu...@uv.es>tel. +34 963 543
> 658    fax +34 963 543 733
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> *NOTE!*For shipments by EXPRESS COURIER use the following street address:
> C/ Catedrático José Beltrán 2, 46980 Paterna (Valencia), Spain.
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 
> 
>       [[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-phylo mailing list - R-sig-phylo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
> Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Reply via email to