View source: R/simple_relevel.R
simple_relevel | R Documentation |
Function to relevel a variable in accordance to a another variable of class "factor".
simple_relevel(x, ...)
## S3 method for class 'data.frame'
simple_relevel(data, ..., by)
## Default S3 method:
simple_relevel(x, by, map, value = c("unsorted", "sorted", "levels"))
x |
a vector that will be relevelled |
... |
Unquoted variable names that will be relevelled |
data |
A data.frame |
by |
a vector that the relevelling process will base on |
map |
a list that links by to x in the form of list(by.1 = c(x1.1, x1.2...), by.2 = c(x2.1, x2.2...)) or a data.frame with two columns "from" and "to" serving the same purpose. |
value |
a string: whether to return - "levels": new levels only - "unsorted" (default): an unsorted, relevelled factor - "sorted": a sorted, relevelled factor |
An object of the same class as the input
A factor or a numeric vector of order
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.