Learn R Programming

geoSpectral (version 0.17.5)

sort,Spectra-method: Sort a Spectra object

Description

Sort a Spectra object with respect to its rows with respect to values of one given column (specified by which.col). Sorting with respect to multiple columns is not implemented yet.

Usage

# S4 method for Spectra
sort(x, decreasing = FALSE, na.last = NA, which.col, ...)

Arguments

x

A Spectra object

decreasing

Logical. If TRUE, then the rows are sorted in decreasing order. Passed on to the sort.idx() function from the base package. Default is FALSE.

na.last

for controlling the treatment of NAs. Passed on to the sort.idx() function from the base package. Default is NA.

which.col

A character, defining the name of the column to be used in the sorting

...

arguments to be passed to or from methods. See help of sort.

Examples

Run this code
# NOT RUN {
sp <- spc.example_spectra()
sp2 <- sort(sp, which.col="Offset")
sp2$Offset
sp2 <- sort(sp, which.col="CAST", decreasing=TRUE)
sp2$CAST

# }

Run the code above in your browser using DataLab