Utility to convert phyloseq slots to tibbles.

get_tibble(x, slot = "otu_table", column_id = "column_id")

Arguments

x

phyloseq-class object

slot

Must be one of c("otu_table", "sam_data", "tax_table"). Default= "otu_table"

column_id

Provide name for the column which will hold the rownames of slot.

Value

A tibble

Examples

library(microbiomeutilities)
data("zackular2014")
p0 <- zackular2014
otu_tibble <- get_tibble(p0,slot="otu_table",column_id="OTUID")
head(otu_tibble)
#> # A tibble: 6 × 89
#>   OTUID  Adeno…¹ Adeno…² Adeno…³ Adeno…⁴ Adeno…⁵ Adeno…⁶ Adeno…⁷ Adeno…⁸ Adeno…⁹
#>   <chr>    <int>   <int>   <int>   <int>   <int>   <int>   <int>   <int>   <int>
#> 1 d__de…       0       0       0       0       0       0       0       0       0
#> 2 d__de…       0       0       0       6       0       0       2       0       0
#> 3 d__de…       0       0       3       0       0       0       0       0       0
#> 4 d__de…       0       0       0      15       1       0       0       0       2
#> 5 d__de…       1       0       1       1       4       1       1       0       0
#> 6 d__de…       0       1       0       0       0       0       0       0       0
#> # … with 79 more variables: `Adenoma20-2995` <int>, `Adenoma21-3129` <int>,
#> #   `Adenoma2-2113` <int>, `Adenoma22-3133` <int>, `Adenoma23-3141` <int>,
#> #   `Adenoma24-3217` <int>, `Adenoma25-3273` <int>, `Adenoma26-3373` <int>,
#> #   `Adenoma27-3379` <int>, `Adenoma28-3391` <int>, `Adenoma29-3399` <int>,
#> #   `Adenoma30-3509` <int>, `Adenoma3-2123` <int>, `Adenoma4-2143` <int>,
#> #   `Adenoma5-2243` <int>, `Adenoma6-2453` <int>, `Adenoma7-2475` <int>,
#> #   `Adenoma8-2555` <int>, `Adenoma9-2717` <int>, `Cancer10-2567` <int>, …