This function aims to assign an id to factor or similar character
strings. Regarding factors, as.integer()
does such task but the order
obtained may differ.
assignIds(x, alphabetical = FALSE)
x | an R object to be coerced into character type. |
---|---|
alphabetical | a logical indicating whether an alphabetical sorting must be applied. |
A vector of Ids.
#> [1] 1 2 3 2