normalize | R Documentation |
Performs a normalization of data, i.e., it scales variables in the range
0 - 1. This is a special case of rescale()
. unnormalize()
is the
counterpart, but only works for variables that have been normalized with
normalize()
.
normalize(x, ...)
## S3 method for class 'numeric'
normalize(x, include_bounds = TRUE, verbose = TRUE, ...)
## S3 method for class 'data.frame'
normalize(
x,
select = NULL,
exclude = NULL,
include_bounds = TRUE,
append = FALSE,
ignore_case = FALSE,
regex = FALSE,
verbose = TRUE,
...
)
unnormalize(x, ...)
## S3 method for class 'numeric'
unnormalize(x, verbose = TRUE, ...)
## S3 method for class 'data.frame'
unnormalize(
x,
select = NULL,
exclude = NULL,
ignore_case = FALSE,
regex = FALSE,
verbose = TRUE,
...
)
## S3 method for class 'grouped_df'
unnormalize(
x,
select = NULL,
exclude = NULL,
ignore_case = FALSE,
regex = FALSE,
verbose = TRUE,
...
)
x |
A numeric vector, (grouped) data frame, or matrix. See 'Details'. |
... |
Arguments passed to or from other methods. |
include_bounds |
Numeric or logical. Using this can be useful in case of
beta-regression, where the response variable is not allowed to include
zeros and ones. If |
verbose |
Toggle warnings and messages on or off. |
select |
Variables that will be included when performing the required tasks. Can be either
If |
exclude |
See |
append |
Logical or string. If |
ignore_case |
Logical, if |
regex |
Logical, if |
If x
is a matrix, normalization is performed across all values (not
column- or row-wise). For column-wise normalization, convert the matrix to a
data.frame.
If x
is a grouped data frame (grouped_df
), normalization is performed
separately for each group.
A normalized object.
select
argumentFor most functions that have a select
argument (including this function),
the complete input data frame is returned, even when select
only selects
a range of variables. That is, the function is only applied to those variables
that have a match in select
, while all other variables remain unchanged.
In other words: for this function, select
will not omit any non-included
variables, so that the returned data frame will include all variables
from the input data frame.
Smithson M, Verkuilen J (2006). A Better Lemon Squeezer? Maximum-Likelihood Regression with Beta-Distributed Dependent Variables. Psychological Methods, 11(1), 54–71.
See makepredictcall.dw_transformer()
for use in model formulas.
Other transform utilities:
ranktransform()
,
rescale()
,
reverse()
,
standardize()
normalize(c(0, 1, 5, -5, -2))
normalize(c(0, 1, 5, -5, -2), include_bounds = FALSE)
# use a value defining the bounds
normalize(c(0, 1, 5, -5, -2), include_bounds = .001)
head(normalize(trees))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.