Extract clades from a lineage, as defined in the {yatah}
package.
Arguments
- recipe
A recipe object. The step will be added to the sequence of operations for this recipe.
- ...
One or more selector functions to choose variables for this step. See
selections()
for more details.- role
For model terms created by this step, what analysis role should they be assigned? By default, the new columns created by this step from the original variables will be used as
predictors
in a model.- trained
A logical to indicate if the quantities for preprocessing have been estimated.
- rank
The desired ranks, a combinaison of
"kingdom"
,"phylum"
,"class"
,"order"
,"family"
,"genus"
,"species"
, or"strain"
. Seeyatah::get_clade()
for more details.- res
This parameter is only produced after the recipe has been trained.
- keep_original_cols
A logical to keep the original variables in the output. Defaults to
FALSE
.- skip
A logical. Should the step be skipped when the recipe is baked by
bake()
? While all operations are baked whenprep()
is run, some operations may not be able to be conducted on new data (e.g. processing the outcome variable(s)). Care should be taken when usingskip = TRUE
as it may affect the computations for subsequent operations.- id
A character string that is unique to this step to identify it.
- x
A
step_taxonomy
object.
Value
An updated version of recipe with the new step added to the sequence of any existing operations.
Examples
data("cheese_taxonomy")
rec <-
cheese_taxonomy %>%
select(asv, lineage) %>%
recipe(~ .) %>%
step_taxonomy(lineage, rank = c("order", "genus")) %>%
prep()
rec
#>
#> ── Recipe ──────────────────────────────────────────────────────────────────────
#>
#> ── Inputs
#> Number of variables by role
#> predictor: 2
#>
#> ── Training information
#> Training data contained 74 data points and no incomplete rows.
#>
#> ── Operations
#> • Taxonomy features from: lineage | Trained
tidy(rec, 1)
#> # A tibble: 2 × 3
#> terms rank id
#> <chr> <chr> <chr>
#> 1 lineage order taxonomy_gF0fi
#> 2 lineage genus taxonomy_gF0fi
bake(rec, new_data = NULL)
#> # A tibble: 74 × 3
#> asv lineage_order lineage_genus
#> <fct> <chr> <chr>
#> 1 asv_01 Dothideales Aureobasidium
#> 2 asv_02 Eurotiales Aspergillus
#> 3 asv_03 Eurotiales Penicillium
#> 4 asv_04 Eurotiales Penicillium
#> 5 asv_05 Eurotiales Penicillium
#> 6 asv_06 Eurotiales Penicillium
#> 7 asv_07 Eurotiales Penicillium
#> 8 asv_08 Eurotiales Penicillium
#> 9 asv_09 Eurotiales Penicillium
#> 10 asv_10 Saccharomycetales Debaryomyces
#> # ℹ 64 more rows