Learn R Programming

bioset (version 0.2.3)

set_calc_variability: Calculate parameters of variability for a given set of values.

Description

Calculate mean, standard deviation and coefficient of variation for groups of values.

Usage

set_calc_variability(data, ids, ...)

Arguments

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.

Value

A tibble containing all original and additional columns (NAMEA_mean, NAMEA_n, NAMEA_sd, NAMEA_cv, (NAMEB_mean, ...)).

Details

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).

See Also

Other set functions: set_calc_concentrations, set_read, sets_read

Examples

Run this code
# NOT RUN {
# 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"
)
# }
# NOT RUN {
rm(cals)

# }

Run the code above in your browser using DataLab