Rescale a vector relative to the maximal absolute value in the vector

proportion(x, na.rm = FALSE)

Arguments

x

a numeric vector

na.rm

a logical indicating whether missing values should be removed

Examples

proportion(mtcars$mpg)
#>  [1] 0.6194690 0.6194690 0.6725664 0.6312684 0.5516224 0.5339233 0.4218289
#>  [8] 0.7197640 0.6725664 0.5663717 0.5250737 0.4837758 0.5103245 0.4483776
#> [15] 0.3067847 0.3067847 0.4336283 0.9557522 0.8967552 1.0000000 0.6342183
#> [22] 0.4572271 0.4483776 0.3923304 0.5663717 0.8053097 0.7669617 0.8967552
#> [29] 0.4660767 0.5811209 0.4424779 0.6312684