px_order {pxmake} | R Documentation |
Change value order
Description
Inspect or change ORDER.
Usage
px_order(x, value, validate)
## S3 method for class 'px'
px_order(x, value, validate = TRUE)
Arguments
x |
A px object |
value |
Optional. A data frame with the columns 'order' and one or more of the columns: 'variable-code', and 'code'. If 'value' is missing, the current ORDER is returned. If NULL, ORDER is removed. |
validate |
Optional. If TRUE a number of validation checks are performed on the px object, and an error is thrown if the object is not valid. If FALSE, the checks are skipped, which can be usefull for large px objects where the check can be time consuming. Use |
Value
A px object or data frame.
Examples
# Set ORDER for a variable
library(tibble)
x1 <-
population_gl |>
px() |>
px_order(tribble(~`variable-code`, ~order,
'gender', 8))
# Print ORDER
px_order(x1)
# Set ORDER for a value
x2 <-
x1 |>
px_order(tribble(~`variable-code`, ~code, ~order,
'age', '2004', 9))
px_order(x2)
# Remove ORDER
x3 <- px_order(x2, NULL)
px_order(x3)
[Package pxmake version 0.18.0 Index]