normalize: normalize screen data

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

View source: R/fun-normalize.R

Description

Normalize data, i.e. express each point as its deviation from a center.

Usage

1
2
3
4
5
6
7
normalize(x, variables, method = c("median", "mean", "medpolish"), reference)

## S3 method for class 'data.frame'
normalize(x, variables, method = c("median", "mean", "medpolish"), reference)

## S3 method for class 'grouped_df'
normalize(x, variables, method = c("median", "mean", "medpolish"), reference)

Arguments

x

screen object, i.e. a data.frame, possibly grouped

variables

variables to normalize; character vector of column names or numeric vector of column indices

method

normalization method, see Details

reference

logical predicate that defines reference observations, bare or character

Details

There are three normalization methods available at the moment:

Value

an invisible data.frame

Methods (by class)

Warnings

If you are using the medpolish method, variables will be temporarily converted from vectors to matrices. Make sure your data frames are ordered by column (the default way matrices are filled) rather than by row (the default ScanR format). Also, row and column specifications are necessary to read the matrix dimensions, so x must contain either "row" and "column" variables or a "position" variable.

For other methods a reference subset can be specified. Any logical predicate will do. If no reference is declared, normalization will be done against the whole population.

Grouped data frames (dplyr package)

The method for class grouped_df is home made because the native behavior of grouped data frames does not readily support functions that return data frames.


olobiolo/siscreenr documentation built on Nov. 26, 2021, 3:08 p.m.