Computes the standardization of a sparse_numeric vector which is done by taking taking each element of the vector and subtracting off the vector mean and dividing by the vector standard deviation.

standardize(x, ...)

# S4 method for class 'sparse_numeric'
standardize(x, ...)

Arguments

x

A sparse_numeric object.

...

Additional arguments.

Value

A sparse_numeric object with standardized values.

Examples

x <- new("sparse_numeric", value = c(1, 2), pos = c(2L, 5L), length = 6L)
z <- standardize(x)
as(z, "numeric")
#> [1] 0.0000000 0.6546537 0.0000000 0.0000000 1.9639610 0.0000000