ropensci / RNeXML

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

get_characters() returns columns in different ordering than the list of char objects #242

Open hlapp opened 5 years ago

hlapp commented 5 years ago

More specifically, for a nexml object nex, the lists resulting from

sapply(nex@characters[[1]]@format@char, slot, "label")

and

colnames(get_characters(nex))

will be set equal, but for any index i, their values at that index will be different.

Often this is not terribly problematic because in practice labels are usually unique, and so reordering by label matching will work.

However, labels are not required to be unique. If they aren't unique, according to documentation get_characters() will use the character IDs, which will be unique. But then ones has to know for reordering whether to match against the "id" or "label" slots of character objects.

So long story short, I want to argue for a preserveOrder or similar parameter for get_characters(), whose default value would be FALSE.

cboettig commented 5 years ago

yeah, good call, preserveOrder seems like a reasonable way to deal with this.