normalize_DF {disprose} | R Documentation |
Normalize variable
Description
Normalize variable in a data frame
Usage
normalize_DF(
data,
var.name,
method = "mean",
norm.number,
return = "add.end",
digits = 2
)
Arguments
data |
data frame with numeric variable that should be normalized |
var.name |
character; data frame column name with numeric variable that should be normalized |
method |
character; normalization method; possible values are: |
norm.number |
numeric; a value to normalize to (if |
return |
character; return object; possible values are: |
digits |
integer; number of decimal places to round the normalized value |
Details
This function scales variable to a range of (0-1), where 1 get values that are the most close to mean, median or given number. See normalize for details.
var.name
must be exact column name as in data frame.
Value
Vector or data frame with normalized values.
Author(s)
Elena N. Filatova
Examples
data <- data.frame (N = 1:5, temperature = c(37.5, 36.6, 41.2, 38.8, 36.7),
name = c("Bob", "Kate", "Steve", "Sonya", "Mary"))
normalize_DF (data = data, var.name = "temperature", method = "mean", return = "vector")
normalize_DF (data = data, var.name = "temperature", method = "mean", return = "replace")
normalize_DF (data = data, var.name = "temperature", method = "mean", return = "add.near")
normalize_DF (data = data, var.name = "temperature", method = "number",
norm.number = 36.6, return = "add.end")