set_calc_variability {bioset} | R Documentation |
Calculate mean, standard deviation and coefficient of variation for groups of values.
set_calc_variability(data, ids, ...)
data |
A tibble containing the data. |
ids |
The column holding the names used to group the values. |
... |
The name(s) of the columns used to calculate the variability. |
Dealing with measured values, the measurement of sample "A" is often done in duplicates / triplicates / ... . This function groups all samples with the same name and calculates mean, standard deviation and coefficient of variation (= sd / mean).
A tibble containing all original and additional columns (NAMEA_mean, NAMEA_n, NAMEA_sd, NAMEA_cv, (NAMEB_mean, ...)).
Other set functions: set_calc_concentrations
,
set_read
, sets_read
# generate data library("tibble") data <- tibble( names = c("A", "B", "C", "A", "B", "C"), value = c(19, 59, 22, 18, 63, 28), conc = c(1.9, 5.9, 2.2, 1.8, 6.3, 2.8) ) data set_calc_variability( data = data, ids = names, value, conc ) # to set column names use notation like in dplyr / tidyverse ## Not run: # notice how strings are given as column names set_calc_variability( data = data, ids = "names", "value", "conc" ) ## End(Not run) rm(cals)