Standardize a numeric vector
standardize.RdStandardize a numeric vector. Defaults to centering on the mean and scaling on the standard deviation.
Examples
#----------------------------------------------------------------------------
# standardize() examples
#----------------------------------------------------------------------------
library(bkstat)
x <- rnorm(100, mean = 30, sd = 20)
standardize(x)
#> [1] -0.635218999 -1.071233031 -0.017588342 -0.111783805 -0.948559340
#> [6] 0.566360004 -0.156078283 0.331354319 -2.248894545 -1.536603929
#> [11] 0.974928822 0.707945135 -0.589320947 1.119988338 -0.201065161
#> [16] 0.764173912 0.386013684 0.081874334 -1.028963043 0.159450264
#> [21] -0.006655506 1.112951755 -0.973087383 0.730556384 -0.573677973
#> [26] -0.087130772 1.709075246 0.366372662 0.171838483 0.731029441
#> [31] 1.297321486 0.750803132 -0.016418987 0.364309381 -1.326955067
#> [36] 1.226739074 0.654429475 0.764644686 1.049767885 -1.328029552
#> [41] -0.224530176 1.285293053 -0.037902776 0.047950220 -0.210615145
#> [46] 0.511455542 1.808735597 -0.773387576 0.157765946 0.033315540
#> [51] -0.026997642 -0.743108084 -1.132027804 -1.290890866 -0.289472511
#> [56] 0.086676293 2.119646686 0.861357139 -0.615051830 -2.186001913
#> [61] 0.698228226 -0.510853582 0.029938430 1.008958488 1.478919437
#> [66] -0.141914737 -0.622388422 1.135946859 0.211573394 -1.156439925
#> [71] 0.615814099 2.604425603 0.184503514 -0.711785473 -1.123665958
#> [76] 1.154727747 0.048209729 -0.166654469 -0.931111832 -0.282331889
#> [81] 0.100116701 0.074761195 0.219695894 -0.983661307 0.577329227
#> [86] -1.064709804 0.126508539 -1.599586368 -2.208078966 -0.841000845
#> [91] -0.711631493 -2.134289606 -2.282287251 1.996308665 0.797597802
#> [96] -0.844162591 1.397310571 -0.166932354 0.822644696 0.653095130