norm_to_max: Normalize rows to the maximum value

Description Usage Arguments Examples

View source: R/norm_to_max.R

Description

Reads rows and normalized the values based on the maximum of the row (range 0-1).

Usage

1
2
3
norm_to_max(x, columns = "..all..", label = "nmax_",
  complete_match = FALSE, sub_min = TRUE, na.rm = TRUE,
  drop_input = FALSE)

Arguments

x

A dataframe with the values to be normalized.

columns

Vector containing column names to be standardized. By default all columns will be selected "..all..". You can add a vector with the column names, or a part of the column name that is unique and use partial matching to identify columns (e.g. "values_"). If complete matching is used, specify complete_match argument to TRUE.

label

Label tag to be added in each collumn. Default value is "nmax_".

complete_match

Logical with default value FALSE that allows partial matching of the column names for selection of the column for normalizaiton. If set to TRUE, columns that match exactly with the input will be used.

sub_min

Logical with default value TRUE. By default the calculation is (x - x_min) / (x_max - x_min). If sub_min is set to FALSE the normalization will be performed as: x / x_max

na.rm

Action for missing values when calculating min and max values. Defalut is TRUE

drop_input

Select if you want to append the normalized data into the input dataframe or keep only them. Logical with default value FALSE, meaning that the processed values will be added to the input.

Examples

1
2
3
4
5
6
data <- data.frame(L1 = c("a", "b", "c", "d", "e", "f", "g", "h"),
                   V1 = c(1, 2, 3, 6, 1, 3, 4, 4),
                   V2 = c(3, 4, 5, 3, 5, 5, 3, 2),
                   V3 = c(6, 7, 4, 2, 3, 2, 7, 6))
 norm_to_max(data, columns = "V")
 norm_to_max(data, columns = "V", sub_min = FALSE)

tkostas/komics documentation built on May 24, 2019, 7:31 a.m.