sort_val_labs {labelr} | R Documentation |
Sort Ascending Any Variable Value Labels
Description
sort_val_labs
sorts the presentation order of variable value label meta-data.
Usage
sort_val_labs(data)
Arguments
data |
a data.frame |
Details
This function is used in internally by other labelr functions to ensure that value label meta-data is sorted in a logical, intuitive order. It is not intended for interactive use.
Value
a data.frame
Examples
# note that this example is trivial, as value labels already are in order
df <- mtcars
df <- add_val_labs(
data = df,
vars = "am",
vals = c(0, 1),
labs = c("automatic", "manual")
)
df <- add_val_labs(
data = df,
vars = "carb",
vals = c(1, 2, 3, 4, 6, 8),
labs = c(
"1-carb", "2-carbs",
"3-carbs", "4-carbs",
"6-carbs", "8-carbs"
)
)
df <- sort_val_labs(df)
[Package labelr version 0.1.7 Index]