powered by
Sort value labels according to values or to labels
sort_val_labels(x, according_to = c("values", "labels"), decreasing = FALSE)
A labelled vector or a data.frame
According to values or to labels?
In decreasing order?
v <- labelled(c(1, 2, 3), c(maybe = 2, yes = 1, no = 3)) v sort_val_labels(v) sort_val_labels(v, decreasing = TRUE) sort_val_labels(v, 'l') sort_val_labels(v, 'l', TRUE)
Run the code above in your browser using DataLab