david-barnett / microViz

R package for microbiome data visualization and statistics. Uses phyloseq, vegan and the tidyverse. Docker image available.
https://david-barnett.github.io/microViz/
GNU General Public License v3.0
101 stars 11 forks source link

tax_select using a list for input? #99

Closed carmennns2 closed 1 year ago

carmennns2 commented 1 year ago

Hi,

Silly question.

I have been manually typing the taxas I would like to subset using tax_select. e.g. (tax_select(physeq, tax_list = c("Eisenbergiella", "Eubacterium_g17", "Ruminococcus_g5", "PAC001609_g"....)) + 50 taxas

When I try to enter the taxas into a list, and use the list as input, it does not work. e.g. names <- as. list(c("Eisenbergiella", "Eubacterium_g17", "Ruminococcus_g5", "PAC001609_g"....) tax_select(physeq, tax_list = names).

Is there a way I can subset large number of taxas without manually typing each?

Thanks!

david-barnett commented 1 year ago

Hi @carmennns2

If you already have a vector of taxa names, you can leave them as a vector. A list class object will not work.

If you have a list of taxa names, try unlist()

your_list = list("Eisenbergiella", "Eubacterium_g17", "Ruminococcus_g5", "PAC001609_g")
tax_select(physeq, tax_list = unlist(your_list))

hope this helps?

carmennns2 commented 1 year ago

Thank you! It works!(: