Learn R Programming

tidyrstats (version 0.1.0)

scale_this: Scale a numeric vector without converting to a matrix

Description

This function scales and centres a numeric vector by subtracting the mean and dividing by the standard deviation. Unlike `scale()`, it returns a numeric vector, not a matrix. Note this function does not allow control over centering or scaling.

Usage

scale_this(x)

Value

A numeric vector of scaled values.

Arguments

x

A numeric vector.

Examples

Run this code
iris_dat <- head(iris$Sepal.Length)
scale_this(iris_dat)
scale_this(c(iris_dat, NA))

Run the code above in your browser using DataLab