Create functions to standardize and unstandardize data
standardizer(x)
a numeric vector or a data.frame with only numeric columns. Non numeric columns are dropped.
If x was a vector, the function returns a list containing two functions : scale and unscale. The first one is an equivalent of the classical function scale(x, center = TRUE, scale = TRUE). The second can be used to reverse the scaling and get back original units. If x was a data.frame, the same pair of functions is returned inside of a list for each numeric column.
data(LyonIris)
LyonScales <- standardizer(sf::st_drop_geometry(LyonIris))