createSplits {benchdamic}R Documentation

createSplits

Description

Given the phyloseq object from which the random splits should be created, this function produces a list of 2 data.frame objects: Subset1 and Subset2 with as many rows as the number of splits and as many columns as the half of the number of samples.

Usage

createSplits(object, varName = NULL, paired = NULL, balanced = TRUE, N = 1000)

Arguments

object

a phyloseq object.

varName

name of a factor variable with 2 levels.

paired

name of the unique subject identifier variable. If specified, paired samples will remain in the same split. (default = NULL).

balanced

If TRUE a balanced design will be created for the splits. (Ignored if paired is supplied).

N

number of splits to generate.

Value

A list of 2 data.frame objects: Subset1 and Subset2 containing N rows and half of the total number of samples columns. Each cell contains a unique sample identifier.

Examples

data(ps_plaque_16S)
set.seed(123)

# Balanced design for repeated measures
splits_df <- createSplits(
    object = ps_plaque_16S, varName =
        "HMP_BODY_SUBSITE", paired = "RSID", balanced = TRUE, N = 100
)

# Balanced design for independent samples
splits_df <- createSplits(
    object = ps_plaque_16S, varName =
        "HMP_BODY_SUBSITE", balanced = TRUE, N = 100
)

# Unbalanced design
splits_df <- createSplits(
    object = ps_plaque_16S, varName =
        "HMP_BODY_SUBSITE", balanced = FALSE, N = 100
)

[Package benchdamic version 1.0.0 Index]