zt: Extended function for z-transformation, filling non-finite...

Description Usage Arguments Value Examples

View source: R/int.R

Description

An extended function of the standard z-score standardization of a vector in R (i.e. function 'scale'). Supports filling in non-finite values as well as re-naming variables to distinguish them from non-standardized variables.

Usage

1
zt(x, fillfinite = 0, addz = T, saveattr = T)

Arguments

x

A data matrix for which the columns are to be standardized

fillfinite

The value to fill non-finite values with, by default zero.

addz

Boolean indicating whether letter 'z' should be appended to the variable names to indicate the standardization

saveattr

Boolean for if an 'attr' should be attached to the standardized vector, similar to how the R default function 'scale' conserves the centering and scaling values

Value

z-score standardized values (zero mean and unit variation), with non-finite values imputed by zero by default.

Examples

1
2
3
4
5
somedata <- cbind(rnorm(100), runif(100))
normdata <- zt(somedata)
head(normdata)
apply(normdata, MARGIN=2, FUN=mean)
apply(normdata, MARGIN=2, FUN=sd)

ePCR documentation built on Dec. 1, 2019, 1:21 a.m.

Related to zt in ePCR...