cv by sample — cv_by_sample_estimation • protGear
Description: A function to give the summary of the CV's by the sampleID

# cv by sample

Source: `R/cv_by_sample_estimation.R`
`cv_by_sample_estimation.Rd`

A function to give the summary of the CV's by the sampleID

    cv_by_sample_estimation(
      dataCV,
      cv_variable,
      lab_replicates,
      sampleID_var = "sampleID"
    )

## Arguments

dataCV

  A dataframe

cv_variable

  A character string containing the identifier of the variable with CV values.

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'

## Value

A data frame of CV calculated by sample

## Details

Summarise CV by samples

## 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
    dataCV <- cv_estimation(dataC  ,lab_replicates=3)
    #> Warning: The replicates are as expected per sample per antigen
    cv_by_sample_estimation(dataCV, cv_variable = "cvCat_all",
     lab_replicates = 3)
    #> # A tibble: 21 × 7
    #>    sampleID `CV <= 20_n` `CV <= 20_perc` `CV > 20_n` CV > 20_p…¹ Other…² Other…³
    #>    <chr>           <dbl>           <dbl>       <dbl>       <dbl>   <dbl>   <dbl>
    #>  1 0.0085              5            83.3           1        16.7       0     0
    #>  2 0.0255              3            50             2        33.3       1    16.7
    #>  3 0.076               3            50             2        33.3       1    16.7
    #>  4 0.23                4            66.7           2        33.3       0     0
    #>  5 0.73                4            66.7           1        16.7       1    16.7
    #>  6 177.78              6           100             0         0         0     0
    #>  7 19.75               5            83.3           1        16.7       0     0
    #>  8 2.19                3            50             3        50         0     0
    #>  9 533                 6           100             0         0         0     0
    #> 10 59.26               5            83.3           1        16.7       0     0
    #> # … with 11 more rows, and abbreviated variable names ¹​`CV > 20_perc`,
    #> #   ²​Others_n, ³​Others_perc