omixerRand: Multivariate Randomization

Description Usage Arguments Value Examples

View source: R/omixerRand.R

Description

As the main function of the Omixer package, this function outputs a randomized sample list that minimizes correlations between biological factors and technical covariates.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
omixerRand(
  df,
  sampleId = "sampleId",
  block = "block",
  iterNum = 1000,
  wells,
  div = "none",
  positional = FALSE,
  plateNum = 1,
  layout,
  mask = 0,
  techVars,
  randVars
)

Arguments

df

Sample list

sampleId

String specifying sample ID variable

block

Paired sample identifier

iterNum

Number of layouts to generate

wells

Number of wells on a plate

div

Plate subdivisions

positional

Logical indicator of positional batch effects

plateNum

Number of plates

layout

Custom plate layout as data frame

mask

Wells to be left empty

techVars

Technical covariates

randVars

Randomization variables

Value

Selected randomized sample list as a data frame

Randomization environment of optimal list generation

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
library(tibble)
library(forcats)
library(stringr)

sampleList <- tibble(sampleId=str_pad(1:48, 4, pad="0"),
sex=as_factor(sample(c("m", "f"), 48, replace=TRUE)), 
age=round(rnorm(48, mean=30, sd=8), 0), 
smoke=as_factor(sample(c("yes", "ex", "never"), 48, replace=TRUE)),
date=sample(seq(as.Date('2008/01/01'), as.Date('2016/01/01'), 
               by="day"), 48))
               
randVars <- c("sex", "age", "smoke", "date")

omixerLayout <- omixerRand(sampleList, sampleId="sampleId", 
block="block", iterNum=10, wells=48, div="row", 
plateNum=1, randVars=randVars)

Example output

Random seed saved to working directory

Omixer documentation built on Feb. 4, 2021, 2:01 a.m.