x <- c(0.23, 0.32, 0.12, 0.61, 0.26, 0.24, 0.23, 0.32, 0.29, 0.27)
data.frame(
x = normalize(x),
v = normalize(x, range = 0:2),
b = normalize(x, bounds = 0:10),
vb = normalize(x, range = 0:2, bounds = 0:10)
)
# maintains matrix
mat <- structure(c(0.24, 0.92, 0.05, 0.37, 0.19, 0.69, 0.43, 0.22, 0.85,
0.73, 0.89, 0.68, 0.57, 0.89, 0.61, 0.98, 0.75, 0.37, 0.24, 0.24,
0.34, 0.8, 0.25, 0.46, 0.03, 0.71, 0.79, 0.56, 0.83, 0.97), dim = c(10L, 3L))
mat
normalize(mat, bounds = -1:1)
normalize(as.data.frame(mat), bounds = -1:1)
Run the code above in your browser using DataLab