ropensci / RNeXML

Implementing semantically rich NeXML I/O in R
https://docs.ropensci.org/RNeXML
Other
13 stars 9 forks source link

get_characters() fails with an error in dplyr::bind_rows() #171

Closed hlapp closed 5 years ago

hlapp commented 5 years ago

The following line in get_characters.R fails with Columnsymbolcan't be converted from integer to character:

states <- dplyr::bind_rows(states, polymorph)
Error in bind_rows_(x, .id) : 
  Column `symbol` can't be converted from integer to character

This seems to happen only in R 3.5.+, not in R 3.3.x. I don't know whether this happens for all inputs with polymorphic characters or only some. I came across this from the Rphenoscape vignette, where it breaks rendering the vignette:

install_github("xu-hong/rphenoscape")
library(rphenoscape)
nex <- pk_get_ontotrace_xml(taxon = c("Ictalurus", "Ameiurus"), entity = "fin spine")
m <- pk_get_ontotrace(nex)

The last instruction internally calls get_characters():

m <- get_characters(nex, rownames_as_col = TRUE,
                    otu_id = TRUE, otus_id = TRUE)

Which then results in the given error.

cboettig commented 5 years ago

Thanks! And it looks like that line is an example of one not covered by current unit tests: https://codecov.io/gh/ropensci/RNeXML/src/master/R/get_characters.R#L59

whoops!

Should definitely be fixed. Somewhat tangential, but actually hoping to have an RNeXML re-write in the near future based on the nexld approach which I think should make the code-base a lot simpler and more robust. Meanwhile will try and patch this soon