DiscreteCovariateNames {EpiForsk} | R Documentation |
Extract discrete covariate names
Description
Detect elements in covariates which match a string from the discrete_covariates argument.
Usage
DiscreteCovariateNames(covariates, discrete_covariates = NULL)
Arguments
covariates |
character, names of covariates |
discrete_covariates |
character, names of discrete covariates. Currently
it is assumed that discrete covariates are one-hot encoded with naming in
covariates following |
Value
A character vector with elements from covariates matching the names supplied in discrete_covariates.
Author(s)
KIJA
Examples
one_hot_df <- mtcars |>
dplyr::mutate(across(c(2, 8:11), factor)) |>
as.data.frame() |>
DiscreteCovariatesToOneHot(cyl)
EpiForsk:::DiscreteCovariateNames(colnames(one_hot_df), c("cyl"))
[Package EpiForsk version 0.1.1 Index]