Normalize and scale data per row

rowNormScale(
  x,
  from = 0,
  to = 1,
  naValue = NA,
  low = NULL,
  high = NULL,
  singletMethod = "min",
  col_range = NULL,
  ...
)

Arguments

x, from, to, naValue, singletMethod

arguments passed to jamba::normScale(). Note that the default low,high values use the column range defined by col_range.

low

numeric value or NULL, passed to jamba::normScale() for each row in x. When low is NULL, it uses the minimum value in col_range for each row.

high

numeric value or NULL, passed to jamba::normScale() for each row in x. When high is NULL, it uses the maximum value in col_range for each row.

col_range

integer vector referring to column numbers in the input x matrix to use in jamba::normScale(). When col_range is NULL, it uses all columns in x.

...

additional arguments are passed to jamba::normScale().

Details

This function essentially calls jamba::normScale() on each row of a numeric matrix. By default, it scales values to a fixed numeric range from 0 to 1, where the minimum value is set to 0 and the maximum value is set to 1. It is much more configurable, see jamba::normScale() help docs.

Examples

m <- matrix(1:9, ncol=3);
m;
#>      [,1] [,2] [,3]
#> [1,]    1    4    7
#> [2,]    2    5    8
#> [3,]    3    6    9

rowNormScale(m);
#>      [,1] [,2] [,3]
#> [1,]    0  0.5    1
#> [2,]    0  0.5    1
#> [3,]    0  0.5    1
rowNormScale(m, from=0, to=10);
#>      [,1] [,2] [,3]
#> [1,]    0    5   10
#> [2,]    0    5   10
#> [3,]    0    5   10