Closed zachary-foster closed 7 years ago
This will however remove return_type's ability to return taxa and hierarchies objects
but they can still be accessed via $
?
The list of taxa would still be in the object, but the function would not convert its output to taxon
or hierarchy
objects.
EG
> subtaxa(ex_taxmap)
$`1`
[1] "3" "7" "12" "8" "13" "4" "9" "14" "5" "10" "15"
$`2`
[1] "6" "11" "16" "17"
...
vs
> subtaxa(ex_taxmap, return_type = "taxa")
$`1`
$`1`$`3`
<Taxon>
name: Felidae
rank: family
id: 9681
authority: none
$`1`$`7`
<Taxon>
name: Panthera
rank: genus
id: 146712
authority: none
$`1`$`12`
<Taxon>
name: tigris
rank: species
id: 9696
authority: none
$`1`$`8`
<Taxon>
name: Felis
rank: genus
id: 9682
authority: none
$`1`$`13`
<Taxon>
name: catus
rank: species
id: 9685
authority: none
$`1`$`4`
<Taxon>
name: Notoryctidae
rank: family
id: 4479
authority: none
$`1`$`9`
<Taxon>
name: Notoryctes
rank: genus
id: 4544
authority: none
$`1`$`14`
<Taxon>
name: typhlops
rank: species
id: 93036
authority: none
$`1`$`5`
<Taxon>
name: Hominidae
rank: family
id: 9604
authority: none
$`1`$`10`
<Taxon>
name: homo
rank: genus
id: 9605
authority: none
$`1`$`15`
<Taxon>
name: sapiens
rank: species
id: 9606
authority: none
$`2`
$`2`$`6`
<Taxon>
name: Solanaceae
rank: family
id: 4070
authority: none
$`2`$`11`
<Taxon>
name: Solanum
rank: genus
id: 4107
authority: none
$`2`$`16`
<Taxon>
name: lycopersicum
rank: species
id: 49274
authority: none
. . .
vs
> ex_taxmap$taxa
$`1`
<Taxon>
name: Mammalia
rank: class
id: 9681
authority: none
$`2`
<Taxon>
name: Plantae
rank: kingdom
id: 33090
authority: none
$`3`
<Taxon>
name: Felidae
rank: family
id: 9681
authority: none
$`4`
<Taxon>
name: Notoryctidae
rank: family
id: 4479
authority: none
$`5`
<Taxon>
name: Hominidae
rank: family
id: 9604
authority: none
These do very similar things, so they might as well have the same name and implementation. Maybe rename
return_type
tovalue
and make it work likevalue
currently does, which is more consistent with how other functions work. This will however removereturn_type
's ability to returntaxa
andhierarchies
objects. I think the added flexibility of being able to use everything inall_names
makes it worth it.