ropensci / taxa

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

zero length vectors mess up print method a bit #148

Closed zachary-foster closed 6 years ago

zachary-foster commented 6 years ago
<Taxmap>
  17 taxa: b. Mammalia, c. Plantae, d. Felidae, e. Notoryctidae ... o. typhlops, p. sapiens, q. lycopersicum, r. tuberosum
  17 edges: NA->b, NA->c, b->d, b->e, b->f, c->g, d->h, d->i, e->j, f->k, g->l, h->m, i->n, j->o, k->p, l->q, l->r
  5 data sets:
    info:
      # A tibble: 6 x 4
        taxon_id name  n_legs dangerous
        <chr>    <fct>  <dbl> <lgl>    
      1 m        tiger     4. TRUE     
      2 n        cat       4. FALSE    
      3 o        mole      4. FALSE    
      # ... with 3 more rows
    phylopic_ids: a named vector of 'character' with 6 items
       m. e148eabb-f138-43c6-b1e4-5cda2180485a ... r. 63604565-0406-460b-8cb8-1abe954b3f3a
    foods: a list of 6 items named by taxa:
       m, n, o, p, q, r
    abund:
      # A tibble: 8 x 5
        taxon_id code  sample_id count taxon_index
        <chr>    <fct> <fct>     <dbl>       <int>
      1 m        T     A            1.           1
      2 n        C     A            2.           2
      3 o        M     B            5.           3
      # ... with 5 more rows
    new_table: a vector of 'numeric' with 0 items
        1 functions:
    reaction
zachary-foster commented 6 years ago

so do zero length tables:

<Taxmap>
  17 taxa: b. Mammalia, c. Plantae, d. Felidae, e. Notoryctidae ... o. typhlops, p. sapiens, q. lycopersicum, r. tuberosum
  17 edges: NA->b, NA->c, b->d, b->e, b->f, c->g, d->h, d->i, e->j, f->k, g->l, h->m, i->n, j->o, k->p, l->q, l->r
  5 data sets:
    info:
      # A tibble: 6 x 4
        taxon_id name  n_legs dangerous
        <chr>    <fct>  <dbl> <lgl>    
      1 m        tiger     4. TRUE     
      2 n        cat       4. FALSE    
      3 o        mole      4. FALSE    
      # ... with 3 more rows
    phylopic_ids: a named vector of 'character' with 6 items
       m. e148eabb-f138-43c6-b1e4-5cda2180485a ... r. 63604565-0406-460b-8cb8-1abe954b3f3a
    foods: a list of 6 items named by taxa:
       m, n, o, p, q, r
    abund:
      # A tibble: 8 x 5
        taxon_id code  sample_id count taxon_index
        <chr>    <fct> <fct>     <dbl>       <int>
      1 m        T     A            1.           1
      2 n        C     A            2.           2
      3 o        M     B            5.           3
      # ... with 5 more rows
    new_table:
      # A tibble: 0 x 2
      # ... with 2 variables: a <dbl>, b <chr>
NA
  1 functions:
    reaction
zachary-foster commented 6 years ago

fixed