Skip to contents

Performs Shapiro-Wilk tests to check the normality of numeric exposure variables in colData of a MultiAssayExperiment object.

Usage

run_normality_check(expomicset, action = "add")

Arguments

expomicset

A MultiAssayExperiment object containing exposure data in colData.

action

A character string specifying whether to store ("add") or return ("get") the results. Default is "add".

Value

A MultiAssayExperiment object with normality results added to metadata (if action = "add") or a list with:

norm_df

A data frame of Shapiro-Wilk test results for each exposure variable.

norm_plot

A ggplot object showing the distribution of normal and non-normal exposures.

Details

This function:

  • Extracts numeric, non-constant exposure variables from colData.

  • Runs Shapiro-Wilk tests to assess normality.

  • Summarizes the number of normally and non-normally distributed exposures.

  • Generates a bar plot visualizing the normality results.

  • Output Handling:

    • "add": Stores results in metadata(expomicset)$normality.

    • "get": Returns a list containing the normality test results and plot.

Examples

if (FALSE) { # \dontrun{
expom <- run_normality_check(expomicset = expom, action = "add")
norm_results <- run_normality_check(expomicset = expom, action = "get")
} # }