branch_list2table: Branch list na dtable conversion

View source: R/ncbitree.R

branch_list2tableR Documentation

Branch list na dtable conversion

Description

Turns a list of branches into a table with, or vice versa.

Usage

branch_list2table(
  branch.lst,
  ranks = c("superkingdom", "phylum", "class", "order", "family", "genus", "species")
)

Arguments

branch.lst

a list of branches.

ranks

texts specifying the ranks to keep and their ordering.

branch.tbl

a table of branches.

Details

Instead of having branches in a list, it is convenient in R to have data in tables. The branch_list2table converts a list of branches into a table, with one row for each branch and a column for each rank. Since branches may contain different ranks, they must first be pruned to have the exact same ranks in the exact same order. This is done by branch_prune inside this function. The ranks specified in ranks are the columns in the table returned here.

The function branch_table2list converts back again, i.e. from a table to a list.

Value

The branch_list2table returns a tibble with one row for each branch and a column for each rank. The cells contain the tax_id's or names in the branch.lst.

The branch_table2list returns a list where each element contains a named vector of tax_id or texts, and the name of each element is its rank in the taxonomy.

Author(s)

Lars Snipen.


larssnip/microclass documentation built on Nov. 1, 2023, 2:39 p.m.