scaleData: Center and Scale Numeric Columns of a Data Frame

View source: R/scaleData.R

scaleDataR Documentation

Center and Scale Numeric Columns of a Data Frame

Description

Centers and scales all numeric- or integer-valued columns of a data frame object.

Usage

scaleData(df, sampleColName = NULL)

Arguments

df

a data frame object

sampleColName

column of data frame containing sample numbers (i.e., integers 1, 2, ...) for each site

Details

This function extracts all numeric- or integer-valued columns of a data frame object. Each of these columns is centered by subtracting its mean and then scaled by dividing the result by the standard deviation of the original column values. This linear transformation produces columns with mean zero and unit variance. Both input and output data frame objects have the same column ordering. sampleColName is only needed if data frame contains sample numbers.

Value

The input data frame with all numeric- or integer-valued columns transformed to have mean zero and unit variance.


RobertDorazio/eDNAoccupancy documentation built on Sept. 5, 2023, 9:57 a.m.