cv_estimation — cv_estimation • protGear
Description: A function to calculate the CV for the technical lab replicates. The default values are set as per the object names generated by machine

# cv_estimation

Source: `R/cv_estimation_tag_functions.R`
`cv_estimation.Rd`

A function to calculate the CV for the technical lab replicates. The default values are set as per the object names generated by machine

    cv_estimation(
      dataC,
      lab_replicates,
      sampleID_var = "sampleID",
      antigen_var = "antigen",
      replicate_var = "replicate",
      mfi_var = "FMedianBG_correct",
      cv_cut_off = 20
    )

## Arguments

dataC

  A dataset a data frame with feature variables to be used

lab_replicates

  A numeric value indicating the number of lab replicates

sampleID_var

  A character string containing the name of the sample identifier variable. Default set to 'sampleID'

antigen_var

  A character string containing the name of the features/protein variable. Default to 'antigen'

replicate_var

  A character string containing the name of the replicate variable. Default to 'replicate'

mfi_var

  A character string containing the name of the variable with MFI value.Assuming background correction is done already. Default to 'FMedianBG_correct'

cv_cut_off

  Optional value indicating the cut off of flagging CV's. Default set at 20.

## Value

A data frame where CV's of the replicates have been calculated

## Details

Coefficient of Variation

## Examples

    dataC <- readr::read_csv(system.file("extdata",
    "dataC.csv", package="protGear"))
    #> Rows: 567 Columns: 11
    #> ── Column specification ────────────────────────────────────────────────────────
    #> Delimiter: ","
    #> chr (3): sampleID, antigen, iden
    #> dbl (8): sample_array_ID, FMedian, BGMedian, FMedianBG_correct, Block, Colum...
    #>
    #> ℹ Use `spec()` to retrieve the full column specification for this data.
    #> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
    ## this file has 3 lab replicates and the default names
    cv_estimation(dataC  ,lab_replicates=3)
    #> Warning: The replicates are as expected per sample per antigen
    #> # A tibble: 126 × 21
    #> # Groups:   antigen [6]
    #>    antigen sampleID sampl…¹  meanX meanX…² meanX…³ meanX…⁴   sdX sdX2_X3 sdX1_X3
    #>    <chr>   <chr>      <dbl>  <dbl>   <dbl>   <dbl>   <dbl> <dbl>   <dbl>   <dbl>
    #>  1 AMA1    0.0085        11   643.    594.    692     642.  98.5    70      69.3
    #>  2 AMA1    0.0255         8   699     700.    672     724.  52.6    74.2    33.9
    #>  3 AMA1    0.076          5   633.    588     668.    642.  81.3    35.4    77.1
    #>  4 AMA1    0.23           2  1725.   1757    1720    1697   60.5    32.5    84.8
    #>  5 AMA1    0.73          19  2504.   2494.   2568.   2450  119.    166.     61.5
    #>  6 AMA1    177.78         4 58262   58208   58640.  57938. 709.    994.    383.
    #>  7 AMA1    19.75         10 64143.  64204.  64280.  63944  353.    476.    367.
    #>  8 AMA1    2.19          16  9243    9294    9031    9404  383.    528.    156.
    #>  9 AMA1    533            1 53180.  52860.  53298   53380. 559.    117.    735.
    #> 10 AMA1    59.26          7 61601   61870.  61848.  61085  894.   1078.   1111.
    #> # … with 116 more rows, 11 more variables: sdX1_X2 <dbl>, CVX <dbl>,
    #> #   CVX2_X3 <dbl>, CVX1_X3 <dbl>, CVX1_X2 <dbl>, cvCat_all <chr>,
    #> #   cvSelected_all <dbl>, iden <chr>, `1` <dbl>, `2` <dbl>, `3` <dbl>, and
    #> #   abbreviated variable names ¹​sample_array_ID, ²​meanX2_X3, ³​meanX1_X3,
    #> #   ⁴​meanX1_X2