Description Usage Arguments Details Value Examples
Rescale an ordinal scale to replace missing categories. This will assure that the currently present ordinal categories are sequential.
1 | replace_ordinal(x, replace = NULL)
|
x |
an object with ordinal categories |
replace |
optional a positive integer or a vector of replacement values. See |
By default replace_ordinal
function replaces the sorted unique elements in x
with a numeric
series 1:n
where n
is the number of categories in the data. The type of the object is
preserved, e.g., if the object type of x
is integer vector, matrix or a data.frame containing
integers, the replacement series as well as the returning object will be integer as well.
If replace
has length 1 and is numeric (in the sense of is.numeric
), the replacement
series will start with replace
. Typical usage might be replace = 0
for a series starting
with 0.
Alternatively, user can provide vector of replacement values. This vector will be used in
provided order and the returned object will have an elements of the requested type. The vector
must be at least as long as the number of categories in x
, but can be larger. This permits
replacement with arbitrary categories, such as with the build-in letters
.
x where categories are replaced with an numeric series of with the provided replacement values
1 2 3 4 5 6 7 8 9 10 11 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.