scaled_mean() calculates scaled row means for a dataframe.

scaled_mean(.x, method = c("r", "c"))

Arguments

.x

a data.frame

method

The method source: both the pure R and C++ versions are efficient

Value

a numeric vector

Examples

library(dplyr)
iris %>%
  select_if(is.numeric) %>%
  scaled_mean()
#>   [1] -1.17102394 -1.39511272 -1.42712540 -1.42712540 -1.17102394 -0.78687174
#>   [7] -1.33108735 -1.20303662 -1.58718882 -1.36310004 -0.97894784 -1.23504931
#>  [13] -1.45913809 -1.71523955 -0.85089711 -0.59479565 -0.91492248 -1.13901126
#>  [19] -0.75485906 -1.01096053 -1.01096053 -1.01096053 -1.42712540 -1.04297321
#>  [25] -1.13901126 -1.29907467 -1.10699857 -1.10699857 -1.17102394 -1.33108735
#>  [31] -1.33108735 -1.01096053 -0.94693516 -0.81888443 -1.33108735 -1.36310004
#>  [37] -1.07498589 -1.23504931 -1.58718882 -1.17102394 -1.20303662 -1.74725223
#>  [43] -1.52316345 -1.01096053 -0.85089711 -1.39511272 -1.01096053 -1.42712540
#>  [49] -1.01096053 -1.26706199  0.78174972  0.55766094  0.81376240 -0.24265614
#>  [55]  0.49363557  0.14149606  0.65369898 -0.72284638  0.49363557 -0.21064345
#>  [61] -0.75485906  0.23753411 -0.21064345  0.39759752 -0.14661809  0.55766094
#>  [67]  0.23753411 -0.08259272  0.17350874 -0.24265614  0.58967362  0.10948338
#>  [73]  0.42961020  0.30155947  0.33357216  0.49363557  0.62168630  0.81376240
#>  [79]  0.33357216 -0.33869418 -0.33869418 -0.40271955 -0.08259272  0.49363557
#>  [85]  0.17350874  0.52564825  0.68571167  0.14149606  0.04545801 -0.17863077
#>  [91] -0.05058004  0.39759752 -0.08259272 -0.72284638 -0.01856736  0.07747069
#>  [97]  0.07747069  0.26954679 -0.69083370  0.01344533  1.35797801  0.52564825
#> [103]  1.35797801  0.87778776  1.16590191  1.74213020 -0.08259272  1.42200337
#> [109]  0.94181313  1.77414288  0.94181313  0.78174972  1.13388923  0.42961020
#> [115]  0.71772435  1.06986386  0.94181313  2.09426971  1.80615557  0.26954679
#> [121]  1.35797801  0.46162289  1.71011752  0.58967362  1.26193996  1.38999069
#> [127]  0.55766094  0.62168630  0.97382581  1.19791459  1.38999069  1.99823166
#> [133]  1.00583850  0.58967362  0.58967362  1.67810484  1.22992728  0.94181313
#> [139]  0.55766094  1.16590191  1.26193996  1.13388923  0.52564825  1.38999069
#> [145]  1.38999069  1.06986386  0.58967362  0.90980045  1.10187654  0.62168630