ropensci / taxa

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

Add `taxon_names` and `taxon_ids` to NSE list #20

Closed zachary-foster closed 7 years ago

zachary-foster commented 7 years ago

This lets users do useful things like filter by taxon name with less typing:

> filter_taxa(ex_taxmap, taxon_names == "Plantae", subtaxa = 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
  2 data sets:
    info:
      # A tibble: 2 × 4
          name n_legs dangerous taxon_id
        <fctr>  <dbl>     <lgl>    <chr>
      1 tomato      0     FALSE       16
      2 potato      0     FALSE       17
    phylopic_ids:  b6400f39-345a-4711-ab4f-92fd4e22cb1a, 63604565-0406-460b-8cb8-1abe954b3f3a
  1 functions:
 reaction

I also made the get_data function able to run functions that don't have any arguments. If they do have arguments, it still assumes that the function is expecting self as the first argument.

Also fixed an error.

sckott commented 7 years ago

LGTM