This function takes a tidy format. Coerces vectors to correct type. Only include covariates that have 2 or more levels. Sample identifiers are stored as rownames.
clean_covariates(md, factors, continuous, sample_identifier)
A data frame with sample identifiers in a column and relevant experimental covariates.
A vector of factor variables.
A vector of continuous variables.
The name of the column with the sample identifiers that map to the gene counts data frame.
A data frame with coerced variables.
data <- tibble::tribble(
~individualID, ~diagnosis, ~RIN,
"ind5436", "control", 7.7,
"ind234", "disease", 7.1
)
clean_covariates(data, factors = c("individualID", "diagnosis"),
continuous = c("RIN"),
sample_identifier = c("individualID"))
#> Warning: 'as.is' should be specified by the caller; using TRUE
#> diagnosis RIN
#> ind5436 control 7.7
#> ind234 disease 7.1