| createSplits {benchdamic} | R Documentation |
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.
createSplits(object, varName = NULL, paired = NULL, balanced = TRUE, N = 1000)
object |
a |
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 |
N |
number of splits to generate. |
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.
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
)