as_ordinal: create a new ordinal variable

Description Usage Arguments

Description

create a new ordinal variable

Usage

1
2
as_ordinal(x, levels = unique(unlist(x)), ranks = 1:length(levels),
  ...)

Arguments

x

a vector of to be used as values for the ordinal vector. These should be characters for most use cases (but can be other types)

levels

vector of of possible values for x; similar to factor levels

ranks

a vector of numeric ranks corresponding to each level.

...

named vectors with alternative values corresponding to 'levels'. Must each have the same length as levels. Can be accessed with alternate. These "external" alternatives are open to user defined alternatives, for example labels in multiple languages.


mabafaba/categorical documentation built on May 3, 2020, 9 p.m.