Trim lineages until the shallowest common rank.
Arguments
- lineage
string. Vector of lineages.
- remove_void
Should void ranks be removed? Default to
TRUE
.- only_tail
Logical to be passed to
trim_void()
. Used only ifremove_void
is set toTRUE
.
Examples
lineage1 <- "k__Bacteria|p__Verrucomicrobia|c__Verrucomicrobiae"
lineage2 <- "k__Bacteria|p__Firmicutes"
lineage3 <- "k__Bacteria|p__|c__Clostridia"
trim_common(c(lineage1, lineage2, lineage3), remove_void = FALSE)
#> [1] "k__Bacteria|p__Verrucomicrobia" "k__Bacteria|p__Firmicutes"
#> [3] "k__Bacteria|p__"
trim_common(c(lineage1, lineage2, lineage3), only_tail = FALSE)
#> [1] "k__Bacteria" "k__Bacteria" "k__Bacteria"