Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mutate_obs: create new vector/table/list if target is unknown #121

Closed
zachary-foster opened this issue Jan 18, 2018 · 2 comments
Closed
Milestone

Comments

@zachary-foster
Copy link
Collaborator

Curerntly, mutate_obs can only add columns to tables. I often want to create a variable for plotting that has per-taxon values, but there is not a per-taxon value table, so I cannot add it with mutate_obs.

If target is not present the following could happen:

  • If the value given is not named and is a vector, then it is stored as a vector with the name determined by target. EG: mutate_obs(obj, "my_vector", 1:10) is the same as obj$data$my_vector <- 1:10
  • If the value is named and is a vector, a new table is made with a single column. EG mutate_obs(obj, "my_table", new_col = 1:10) is the same as obj$data$my_table <- data.frame(new_col = 1:10)

Thoughts @sckott?

@sckott
Copy link
Contributor

sckott commented Jan 18, 2018

That seems reasonable to me.

Does taxmap already know how to deal with a standalone vector, e.g., in your first example abovee there's a new vector - is it clear how to map that to the taxa ?

@zachary-foster
Copy link
Collaborator Author

That seems reasonable to me.

Nice

Does taxmap already know how to deal with a standalone vector, e.g., in your first example abovee there's a new vector - is it clear how to map that to the taxa ?

Yea, it knows how to deal with tables, lists, and vectors, although I usually work with tables so lists and vectors are less well debugged.

@zachary-foster zachary-foster added this to the v0.2.1 milestone Mar 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants