Description Usage Arguments Details Value See Also Examples
Calculate mean, standard deviation and coefficient of variation for groups of values.
1 | 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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | # 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.