replicate_correlation: Measure replicate correlation of variables.

Description Usage Arguments Value Examples

View source: R/replicate_correlation.R

Description

'replicate_correlation' measures replicate correlation of variables.

Usage

1
2
replicate_correlation(sample, variables, strata, replicates,
  replicate_by = NULL, split_by = NULL, cores = NULL)

Arguments

sample

tbl containing sample used to estimate parameters.

variables

character vector specifying observation variables.

strata

character vector specifying grouping variables for grouping prior to normalization.

replicates

number of replicates.

replicate_by

optional character string specifying column containing the replicate id.

split_by

optional character string specifying column by which to split the sample into batches; replicate correlations will be calculate per batch.

cores

optional integer specifying number of CPU cores used for parallel computing using doParallel.

Value

data frame of variable quality measurements

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
set.seed(123)
x1 <- rnorm(10)
x2 <- x1 + rnorm(10) / 100
y1 <- rnorm(10)
y2 <- y1 + rnorm(10) / 10
z1 <- rnorm(10)
z2 <- z1 + rnorm(10) / 1

batch <- rep(rep(1:2, each=5), 2)

treatment <- rep(1:10, 2)

replicate_id <- rep(1:2, each=10)

sample <- 
  tibble::data_frame(x = c(x1, x2), y = c(y1, y2), z = c(z1, z2),
                     Metadata_treatment = treatment, 
                     Metadata_replicate_id = replicate_id, 
                     Metadata_batch = batch)

head(sample)

# `replicate_correlation`` returns the median, min, and max 
# replicate correlation (across batches) per variable
replicate_correlation(sample = sample,
                      variables = c("x", "y", "z"),
                      strata = c("Metadata_treatment"),
                      replicates = 2,
                      split_by = "Metadata_batch",
                      replicate_by = "Metadata_replicate_id",
                      cores = 1) 

cytominer documentation built on Sept. 18, 2017, 1:03 a.m.