## Make test data available
data(sind)
attach(sind)
## Sort dataframe sind into ascending order on the value
## of column 4, Zn
gx.sort(sind, 4)
## Sort dataframe sind into descending order on the value
## of column 4, Zn
gx.sort(sind, 4, reverse = TRUE)
## Sort only the geochemical data in dataframe sind into
## descending order on the value of column 4, Zn. Note
## that sind[, -c(1:3)] moves the old column 4 to
## position 1
gx.sort(sind[, -c(1:3)], 1, reverse = TRUE)
## Detach test data
detach(sind)
Run the code above in your browser using DataLab