Sorts data ascending or descending order

Description

R implementation of the SPSS SORT CASES argument. xpssSortCases reorders the sequence of cases in the dataset based on the values of one or more variables.

Usage

1
xpssSortCases(x, variables = NULL, order ="A")

Arguments

x

a (non-empty) data.frame or input data of class "xpssFrame".

variables

atomic character or character vector with the names of the variables. Also rownames can be used to sort the data.

order

atomic character or character vector containing either "A" for ascending order or "D" for descending order.

Details

The argument order has to be of the same length as the argument variables. Optionally, the sorting can be specified in ascending or descending order for any variable. It is also possible to use combinations of ascending and descending order for different variables.

Value

Returns a sorted xpssFrame.

Author(s)

Andreas Wygrabek

See Also

sort order

Examples

1
2
3
data(fromXPSS)

xpssSortCases(fromXPSS, variables = c("V4", "V7_1", "V7_2"), order = c("A","D","A"))

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.