ropensci / taxa

taxonomic classes for R
https://docs.ropensci.org/taxa
Other
48 stars 12 forks source link

refactor `leaves` to return a vector per taxon like `subtaxa` #127

Closed zachary-foster closed 6 years ago

zachary-foster commented 6 years ago

Leaves currently does:

> leaves(ex_taxmap)
 m  n  o  p  q  r 
12 13 14 15 16 17 

Which makes sense, but issue #126 assumes that there is a list output with one vector like that above per taxon, like subtaxa does:

> subtaxa(ex_taxmap)
$b
 [1]  3  7 12  8 13  4  9 14  5 10 15

$c
[1]  6 11 16 17

$d
[1]  7 12  8 13
...

I can add the simplify option to leaves, so it can work like it did in the past:

> subtaxa(ex_taxmap, simplify = TRUE)
 [1]  3  7 12  8 13  4  9 14  5 10 15  6 11 16 17

If we want to maintain the same behaviour as before, the default can be simplify = TRUE, although that would be different than the other functions. What do you think @sckott? Ok to change the default output of leaves, while maintain the ability to return the same output with simplify = TRUE?

zachary-foster commented 6 years ago

This is done