baseline: subtract baseline from signal

Description Usage Arguments Value Methods (by class) Grouped data frames (dplyr package) Warning

View source: R/fun-baseline.R

Description

Calculate baseline signal and subtract it from all observations.

Usage

1
2
3
4
5
6
7
baseline(x, variables, reference, method = mean, by_group)

## S3 method for class 'data.frame'
baseline(x, variables, reference, method = mean, by_group)

## S3 method for class 'grouped_df'
baseline(x, variables, reference, method = mean, by_group)

Arguments

x

a data.frame or grouped data frame

variables

character vector of variables (columns) to modify

reference

logical predicate that identifies reference observations, given as string or bare; will be passed to subset

method

method with which to compute the baseline, mean or median; given as symbol or string

by_group

character vector of variables to group by (group_by) in case the baseline is to be taken from means of sets of observations rather than from all observations directly

Value

a data.frame with modified variables

Methods (by class)

Grouped data frames (dplyr package)

The method for class grouped_df is home brewed as I don't know how to properly handle this class.

Warning

Be careful when defining references observations. If a group ends up without reference, the procedure will crash. reference should not make use of a grouping variable. It is safest to create a separate viariable for the purpose of reference.


olobiolo/acutils documentation built on Nov. 28, 2021, 9:35 p.m.