ropensci / taxa

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

Add a option similar to `value` that controls how results are named #55

Open zachary-foster opened 7 years ago

zachary-foster commented 7 years ago

Currently, results of functions like supertaxa return taxon information named by taxon id:

> ex_taxmap$supertaxa(subset = taxon_ranks == "species", value = "taxon_names")
$`12`
         7          3          1 
"Panthera"  "Felidae" "Mammalia" 

$`13`
         8          3          1 
   "Felis"  "Felidae" "Mammalia"

...

It would be nice to reuse the code for value to add an option like name_value that controls how each result is named.

It would work like this:

> ex_taxmap$supertaxa(subset = taxon_ranks == "species", value = "taxon_names", name_value = "taxon_ranks")
$`12`
         genus          family         class 
"Panthera"  "Felidae" "Mammalia" 

$`13`
         genus          family         class 
   "Felis"  "Felidae" "Mammalia"

...

This would allow for making mappings between any two variables in all_names()