clean_covariates: Create covariate matrix from tidy metadata data frame.

View source: R/functions.R

clean_covariatesR Documentation

Create covariate matrix from tidy metadata data frame.

Description

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.

Usage

clean_covariates(md, factors, continuous, sample_identifier)

Arguments

md

A data frame with sample identifiers in a column and relevant experimental covariates.

factors

A vector of factor variables.

continuous

A vector of continuous variables.

sample_identifier

The name of the column with the sample identifiers that map to the gene counts data frame.

Value

A data frame with coerced variables.

Examples

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"))

Sage-Bionetworks/sageseqr documentation built on June 13, 2024, 2:11 p.m.