Closed zachary-foster closed 7 years ago
What do you think about how the names of lists and vectors are turned to NA
when all associated taxa are filtered out, but observations are retained with taxonless = TRUE
?
Also, related to issue #38, what do you think about changing the taxonless
option name to remove_obs
?
> (x = filter_taxa(ex_taxmap, taxon_names == "Plantae", subtaxa = TRUE, taxonless = TRUE))
<Taxmap>
5 taxa: 2. Plantae, 6. Solanaceae, 11. Solanum, 16. lycopersicum, 17. tuberosum
5 edges: NA->2, 2->6, 6->11, 11->16, 11->17
3 data sets:
info:
# A tibble: 6 × 4
name n_legs dangerous taxon_id
<fctr> <dbl> <lgl> <chr>
1 tiger 4 TRUE <NA>
2 cat 4 FALSE <NA>
3 mole 4 FALSE <NA>
# ... with 3 more rows
phylopic_ids: e148eabb-f138-43c6-b1e4-5cda2180485a ... b6400f39-345a-4711-ab4f-92fd4e22cb1a, 63604565-0406-460b-8cb8-1abe954b3f3a
foods: a list with 6 items
1 functions:
reaction
> x$data
$info
# A tibble: 6 × 4
name n_legs dangerous taxon_id
<fctr> <dbl> <lgl> <chr>
1 tiger 4 TRUE <NA>
2 cat 4 FALSE <NA>
3 mole 4 FALSE <NA>
4 human 2 TRUE <NA>
5 tomato 0 FALSE 16
6 potato 0 FALSE 17
$phylopic_ids
<NA> <NA> <NA>
"e148eabb-f138-43c6-b1e4-5cda2180485a" "12899ba0-9923-4feb-a7f9-758c3c7d5e13" "11b783d5-af1c-4f4e-8ab5-a51470652b47"
<NA> 16 17
"9fae30cd-fb59-4a81-a39c-e1826a35f612" "b6400f39-345a-4711-ab4f-92fd4e22cb1a" "63604565-0406-460b-8cb8-1abe954b3f3a"
$foods
$foods$<NA>
[1] "mammals" "birds"
$foods$<NA>
[1] "cat food" "mice"
$foods$<NA>
[1] "insects"
$foods$<NA>
[1] "Most things, but especially anything rare or expensive"
$foods$`16`
[1] "light" "dirt"
$foods$`17`
[1] "light" "dirt"
Data frames in
taxmap$data
are pretty well tested, but not lists and vectors. Lists and vectors should be even easier than tables and the functions have been desinged with this in mind, but they have not been tested much with lists and vectors.