Learn R Programming

labelled (version 2.12.0)

sort_val_labels: Sort value labels

Description

Sort value labels according to values or to labels

Usage

sort_val_labels(x, according_to = c("values", "labels"), decreasing = FALSE)

Arguments

x

A labelled vector or a data.frame

according_to

According to values or to labels?

decreasing

In decreasing order?

Examples

Run this code
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