compute_RSD: Compute RSD (relative standard deviation)

Description Usage Arguments Details Value Examples

View source: R/main.R

Description

This function computes the RSD (relative standard deviation) of the values in input_data. Missing values are removed before the computation automatically.

Usage

1
compute_RSD(input_data)

Arguments

input_data

a numeric vector

Details

The RSD in this function is computed by:

sd(input_data, na.rm = TRUE) / mean(input_data, na.rm = TRUE).

Value

The RSD of the values in input_data is computed, as a numeric of length one.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
RSD_1 <- compute_RSD(c(1:10))

data(FF4_qc) # load demo dataset

# RSD of QC:
RSD_2 <- sapply(FF4_qc[FF4_qc$sampleType == "QC", -c(1:5)], compute_RSD)
quantile(RSD_2)

# RSD of different types of QC samples:
# (each metabolote has its own RSD)
RSD_3 <- aggregate(FF4_qc[-c(1:5)], by = list(Type = FF4_qc$sampleType),
                   FUN = compute_RSD)

TIGERr documentation built on Jan. 6, 2022, 5:06 p.m.

Related to compute_RSD in TIGERr...