format_normalize: Normalizes a variable to specified experimental period

View source: R/dataformat.R

format_normalizeR Documentation

Normalizes a variable to specified experimental period

Description

Subtracting mean of the specified period from every value in the variable that's being transformed, i.e. mean of the baseline period

Usage

format_normalize(.data, ID_var, variable, phase_var = Experiment_period,
  phase_value = Baseline, add = 0)

Arguments

.data

a tibble

ID_var

the ID variable, for grouping

variable

name of the variable that is going to be transformed

phase_var

name of the variable containing experimental phases, defaults to Experiment_period

phase_value

name of the value of phase_var which you normalizes towards, defaults to Baseline

add

Optional argument, a number to add to every value if you want the mean to be something other than 0. Defaults to 0.

Value

a tibble, where one variable is transformed

Examples

Normalizing variable bodytemperature to the Baseline period,
contained in variable Experiment_period in data set d

d %>%
  format_normalize(variable = bodytemperature,
                   ID_var = Id,
                   phase_var = Experiment_period,
                   phase_value = Baseline,
                   add = 0)


VegardLysne/bssg documentation built on Aug. 26, 2022, 3:16 p.m.