Learn R Programming

qpcR (version 1.3-7.1)

batchstat: Concatenating or calculating statistics on a 'pcrbatch'

Description

This function will either concatenate data from several pcrbatches or calculate some user-defined statistic on the runs within a pcrbatch. If the latter is chosen, a grouping vector must be supplied for defining the runs to be subjected to statistical analysis.

Usage

batchstat(..., group = NULL,  do = c("cbind", "stat"), statfun = mean)

Arguments

...
one or more pcrbatches. See 'Examples'.
group
in case of do = "stat", a vector defining the groups for statistical analysis.
do
concatenate or analyse?
statfun
the statistical function to be used if do = "stat".

Value

  • Either a concatenated dataframe (do = "cbind"), or a list containing a dataframe(s) with the statistical output for each factor level defined in group, if do = "stat".

encoding

latin1

Details

statfun can be any internal R function, i.e. sd, median etc.

Examples

Run this code
## create 3 'pcrbatch'es
## and concatenate
dat1 <- pcrbatch(reps, fluo = 2:5, model = l4, plot = FALSE)
dat2 <- pcrbatch(reps, fluo = 6:9, model = l4, plot = FALSE)
dat3 <- pcrbatch(reps, fluo = 10:13, model = l4, plot = FALSE)
batchstat(dat1, dat2, dat3)

## one 'pcrbatch' and doing 
## mean on replicates
## defined by 'group'
dat4 <- pcrbatch(reps, fluo = 2:9, model = l4, plot = FALSE)
GROUP <- c(1, 1, 1, 1, 2, 2, 2, 2)
batchstat(dat4, do = "stat", group = GROUP, statfun = mean)

## get the standard deviation 
batchstat(dat4, do = "stat", group = GROUP, statfun = sd)

## do stats on many 'pcrbatch'es
## All batches must have same length!
batchstat(dat1, dat2, dat3, do = "stat", 
          group = c(1, 1, 2, 2))

Run the code above in your browser using DataLab