epict_clean_factors | R Documentation |
This utility function drops empty factor levels from target factors as well as converting them to factors from character variables.
epict_clean_factors(obs, vars = c())
obs |
A |
vars |
A character vector of variables. Defaults to empty. |
A data.table
with empty factors dropped and character vectors
transformed to factors as specified.
Sam Abbott
Preprocessing functions
epict_check_obs()
,
epict_check_raw_obs()
,
epict_drop_na_ct()
,
epict_filter_ids()
,
epict_flag_spurious_obs()
,
epict_make_time_rel_to_first_uncensored()
,
epict_make_time_rel()
obs <- data.frame(
m = c("fa", "aefwe", "efe"),
c = factor(c("fa", "asas", "asa"), levels = c("fa"))
)
summary(obs)
# Default without specifying variables
summary(epict_clean_factors(obs))
# Specify variables
summary(epict_clean_factors(obs, vars = c("m", "c")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.