OpenStatsComplementarySplit: Method "OpenStatsComplementarySplit"

View source: R/OpenStatsComplementarySplit.R

OpenStatsComplementarySplitR Documentation

Method "OpenStatsComplementarySplit"

Description

This function splits the input data according to the defined values in the 'variables' parameter and runs separate analyses on the split datasets. For example, the default split, c("Sex", "LifeStage"), creates independent input data for Males (only), Females, Early, Late, Male.Early, Males.Late, Females.Early, Females.Late and analyses these datasets separately.

Usage

OpenStatsComplementarySplit(
	object    = NULL,
	variables = c("Sex", "LifeStage"),
	debug     = FALSE
)

Arguments

object

Mandatory argument. An instance of the 'OpenStatsAnalysis' object under the MM (linear mixed model) framework.

variables

Vector of names. A vector of variable names that will be fed into the split engine. The default is 'c("Sex", "LifeStage")' that should report the results for the following categories: Males, Females, Early, Late, Male.Early, Males.Late, Females.Early, Females.Late.

debug

Logical flag. Set to TRUE to see the analysis log. Default FALSE.

Value

List of splits and the analysis outputs. The splits contain the name of the partitioning levels (for example Female or Female.Age_15_weeks), and an 'OpenStatsAnalysis' object including the input data, outputs etc. See the examples for a general view of the output object.

Author(s)

Hamed Haseli Mashhadi <hamedhm@ebi.ac.uk>

See Also

OpenStatsAnalysis, plot.OpenStatsComplementarySplit, summary.OpenStatsComplementarySplit

Examples

####################################################################
# Data preparation
# - Continuous data - Creating OpenStatsList object
####################################################################
fileCon <- system.file("extdata", "test_continuous.csv", package = "OpenStats")
test_Cont <- OpenStatsList(
  dataset = read.csv(fileCon),
  testGenotype = "experimental",
  refGenotype = "control",
  dataset.colname.genotype = "biological_sample_group",
  dataset.colname.batch = "date_of_experiment",
  dataset.colname.lifestage = NULL,
  dataset.colname.weight = "weight",
  dataset.colname.sex = "sex"
)
####################################################################
# Analysis
# -  Optimised Linear Mixed Model (MM) framework
####################################################################
MM_result <- OpenStatsAnalysis(
  OpenStatsList = test_Cont,
  method = "MM",
  MM_fixed = data_point ~ Genotype + Weight
)
####################################################################
# Split on Sex
# ** This split is already available from the normal running of OpenStatsAnalysis
####################################################################
output <- OpenStatsComplementarySplit(object = MM_result, variables = "Sex")
# Structure of the output object
lapply(output, names)
# Summaries
summary(output, format = "pandoc") # See knitr:kable function for more formats
# Plots
plot(output, ask = TRUE)

mpi2/OpenStats documentation built on Sept. 17, 2022, 3:58 p.m.