This function calculates the number of SCs (Sample Controls) in a dataset based on unique replicate naming. It works by matching sample types and target combinations in the data, using a pattern to identify SCs or AQSCs (depending on the `AQ` parameter).

numSCs(Data, AQ)

Arguments

Data

A data frame that includes at least two columns: `SampleType` and `Target`. The `SampleType` represents the type of sample, and `Target` refers to the target analyte being measured.

AQ

A logical flag indicating whether the function should search for AQSCs (if `TRUE`) or standard SCs (if `FALSE`). AQSC refers to 'Absolute Quantification Sample Control'.

Value

The function returns an integer indicating the number of SCs found in the data.

Details

The function identifies replicates based on the concatenation of `SampleType` and `Target`. It looks for sample names that match either "AQSC_" or "SC_" patterns, depending on the value of the `AQ` flag. The number of replicates for the identified SC type is then calculated and returned.

Examples

# Example usage:
numSCs(data, AQ = TRUE)
#> Error in numSCs(data, AQ = TRUE): could not find function "numSCs"
numSCs(data, AQ = FALSE)
#> Error in numSCs(data, AQ = FALSE): could not find function "numSCs"