View source: R/ranktransform.R
ranktransform | R Documentation |
Transform numeric values with the integers of their rank (i.e., 1st smallest,
2nd smallest, 3rd smallest, etc.). Setting the sign
argument to TRUE
will
give you signed ranks, where the ranking is done according to absolute size
but where the sign is preserved (i.e., 2, 1, -3, 4).
ranktransform(x, ...)
## S3 method for class 'numeric'
ranktransform(x, sign = FALSE, method = "average", verbose = TRUE, ...)
## S3 method for class 'data.frame'
ranktransform(
x,
select = NULL,
exclude = NULL,
sign = FALSE,
method = "average",
ignore_case = FALSE,
regex = FALSE,
verbose = TRUE,
...
)
x |
Object. |
... |
Arguments passed to or from other methods. |
sign |
Logical, if |
method |
Treatment of ties. Can be one of |
verbose |
Toggle warnings. |
select |
Variables that will be included when performing the required tasks. Can be either
If |
exclude |
See |
ignore_case |
Logical, if |
regex |
Logical, if |
A rank-transformed 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.
Other transform utilities:
normalize()
,
rescale()
,
reverse()
,
standardize()
ranktransform(c(0, 1, 5, -5, -2))
# Won't work
# ranktransform(c(0, 1, 5, -5, -2), sign = TRUE)
head(ranktransform(trees))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.