OpenStatsComplementarySplit: Method "OpenStatsComplementarySplit"

Description Usage Arguments Value Author(s) See Also Examples

View source: R/OpenStatsComplementarySplit.R

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

1
2
3
4
5
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
####################################################################
# 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)

OpenStats documentation built on Nov. 8, 2020, 5:20 p.m.