tests/scale.R

library(coop)

m <- 20
n <- 5
x <- matrix(rnorm(m*n, mean=10, sd=3), m, n)

# center/scale
t1 <- scale(x)
t2 <- scaler(x)
stopifnot(all.equal(t1, t2))

# center
t1 <- scale(x, scale=FALSE)
t2 <- scaler(x, scale=FALSE)
stopifnot(all.equal(t1, t2))

# scale
t1 <- scale(x, center=FALSE)
t2 <- scaler(x, center=FALSE)
stopifnot(all.equal(t1, t2))

Try the coop package in your browser

Any scripts or data that you put into this service are public.

coop documentation built on Sept. 19, 2021, 5:07 p.m.