ropensci / taxa

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

`mutate_obs`: when adding a vector that already exists, overwrite it with msg #168

Open zachary-foster opened 6 years ago

zachary-foster commented 6 years ago
> obj$mutate_obs("is_amplified",
+                unlist(subtaxa_apply(cleaned_obj,
+                                     function(x) any(x %in% names(amp_seqs)),
+                                     include_input = TRUE,
+                                     value = "original_names")))
Adding a new "logical" vector of length 404.
<Taxmap>
  415 taxa: ab. cellular organisms, ac. Eukaryota, ad. Bacteria ... py. graminicola, pz. novo
  415 edges: NA->ab, ab->ac, ab->ad, ac->ae, ac->af, ac->ag ... pm->pu, pn->pv, pp->pw, pp->px, pr->py, ps->pz
  3 data sets:
    tax_data: a named vector of 'character' with 217 items
       gw. cellular organi[truncated] ... kz. cellular organi[truncated]
    original_names: a named vector of 'character' with 217 items
       gw. Achlya_hypogyna_F ... kz. Thraustotheca_clavata_F
    is_amplified: a named vector of 'logical' with 404 items
       ab. TRUE, ac. TRUE, ad. FALSE, ae. TRUE, af. FALSE ... pv. FALSE, pw. FALSE, px. FALSE, py. FALSE, pz. FALSE
  0 functions:
> obj$mutate_obs("is_amplified",
+                unlist(subtaxa_apply(cleaned_obj,
+                                     function(x) any(x %in% names(amp_seqs)),
+                                     include_input = TRUE,
+                                     value = "original_names")))
Error in obj$mutate_obs("is_amplified", unlist(subtaxa_apply(cleaned_obj,  : 
  The dataset "is_amplified" is not a table, so columns cannot be added