R: Calculate parameters of variability for a given set of...

set_calc_variability {bioset} | R Documentation

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

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

### Value

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

### See Also

Other set functions: `set_calc_concentrations`, `set_read`, `sets_read`

### Examples

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

[Package bioset version 0.2.2 Index]