liamrevell / phytools

GNU General Public License v3.0
198 stars 56 forks source link

Bug: brownie.lite doesn't rearrange standard errors #115

Closed blasiusz closed 1 year ago

blasiusz commented 2 years ago

Dear Dr. Revell,

I found an issue with the brownie.lite function, it doesn't use the names in the named vector argument called se. So it only works properly if the se vector contains the values in the order of the tips of the tree. This problem does not apply to the x argument, that one is fine. The reason is that in the brownie.lite function the x variable is reordered with the line x <- x[tree$tip.label] but such reordering is missing for se. An easy solution would be to change to following lines:

if (!is.null(se)) 
    se <- matchDatatoTree(tree, se, "se")
else {

To this:

  if (!is.null(se)) {
    se <- matchDatatoTree(tree, se, "se")
    se <- se[tree$tip.label]
  } else {
liamrevell commented 1 year ago

Fixed. Thanks for the report. Unfortunately, fix is not in current phytools version on CRAN (1.2-0). Will be in next CRAN release.