Learn R Programming

rtpcr (version 2.1.3)

meanTech: Computing the mean of technical replicates

Description

Computes the arithmetic mean of technical replicates for each sample or group. This is often performed before ANOVA or other statistical analyses to simplify comparisons between experimental groups.

Usage

meanTech(
  x,
  groups,
  numOfFactors,
  numberOfrefGenes,
  block,
  set_missing_target_Ct_to_40 = FALSE
)

Value

A data frame with the mean of technical replicates for each group.

Arguments

x

A raw data frame containing technical replicates.

groups

An integer vector or character vector specifying the column(s) to group by before calculating the mean of technical replicates.

numOfFactors

Integer. Number of experimental factor columns

numberOfrefGenes

Integer. Number of reference genes.

block

Character. Block column name or NULL.

set_missing_target_Ct_to_40

If TRUE, missing target gene Ct values become 40; if FALSE (default), they become NA.

Author

Ghader Mirzaghaderi

Details

The meanTech function calculates the mean of technical replicates based on one or more grouping columns. This reduces the dataset to a single representative value per group, facilitating downstream analysis such as fold change calculation or ANOVA.

Examples

Run this code

# Example input data frame with technical replicates
data1 <- read.csv(system.file("extdata", "data_withTechRep.csv", package = "rtpcr"))

# Calculate mean of technical replicates using first four columns as groups
meanTech(data1,
         groups = 1:2,
         numOfFactors = 1,
         numberOfrefGenes = 1,
         block = NULL)

# Another example using different dataset and grouping columns
data2 <- read.csv(system.file("extdata", "data_Lee_etal2020qPCR.csv", package = "rtpcr"))
meanTech(data2, groups = 1:3,
         numOfFactors = 2,
         numberOfrefGenes = 1,
         block = NULL)

Run the code above in your browser using DataLab