Learn R Programming

translateSPSS2R (version 1.0.0)

xpssSortCases: 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

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.

Value

Returns a sorted xpssFrame.

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.

See Also

sort order

Examples

Run this code
data(fromXPSS)

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

Run the code above in your browser using DataLab