Trim void ranks in lineages
Arguments
- lineage
string. Vector of lineages.
- same
logical. Does the lineage have the same depth? Default to
TRUE
.- only_tail
Logical. If
FALSE
(default), void ranks amid lineages and subranks are removed. IfTRUE
, only final void ranks are removed.
Details
If there is a void rank amid a lineage, deeper ranks
will be removed. See the example with lineage3
.
Examples
lineage1 <- "k__Bacteria|p__Verrucomicrobia|c__Verrucomicrobiae|o__|f__"
lineage2 <- "k__Bacteria|p__Firmicutes|c__"
lineage3 <- "k__Bacteria|p__|c__Verrucomicrobiae|o__|f__"
trim_void(c(lineage1, lineage2, lineage3), same = FALSE)
#> [1] "k__Bacteria|p__Verrucomicrobia|c__Verrucomicrobiae"
#> [2] "k__Bacteria|p__Firmicutes"
#> [3] "k__Bacteria"
trim_void(c(lineage1, lineage2, lineage3), same = FALSE, only_tail = TRUE)
#> [1] "k__Bacteria|p__Verrucomicrobia|c__Verrucomicrobiae"
#> [2] "k__Bacteria|p__Firmicutes"
#> [3] "k__Bacteria|p__|c__Verrucomicrobiae"