Learn R Programming

bestNormalize (version 1.6.1)

no_transform: Identity transformation

Description

Perform an identity transformation. Admittedly it seems odd to have a dedicated function to essentially do I(x), but it makes sense to keep the same syntax as the other transformations so it plays nicely with them. As a benefit, the bestNormalize function will also show a comparable normalization statistic for the untransformed data.

Usage

no_transform(x, warn = TRUE, ...)

# S3 method for no_transform predict(object, newdata = NULL, inverse = FALSE, ...)

# S3 method for no_transform print(x, ...)

Arguments

x

A vector

warn

Should a warning result from infinite values?

...

additional arguments

object

an object of class 'no_transform'

newdata

a vector of data to be (potentially reverse) transformed

inverse

if TRUE, performs reverse transformation

Value

A list of class no_transform with elements

x.t

transformed original data

x

original data

n

number of nonmissing observations

norm_stat

Pearson's P / degrees of freedom

The predict function returns the numeric value of the transformation performed on new data, and allows for the inverse transformation as well.

Details

no_transform creates a identity transformation object that can be applied to new data via the predict function.

Examples

Run this code
# NOT RUN {
x <- rgamma(100, 1, 1)

no_transform_obj <- no_transform(x)
no_transform_obj
p <- predict(no_transform_obj)
x2 <- predict(no_transform_obj, newdata = p, inverse = TRUE)

all.equal(x2, x)

# }

Run the code above in your browser using DataLab