sort-SpcList-method: Sort a SpcList object

Description Usage Arguments Examples

Description

Applies the sort() method for Spectra class to every element of a SpcList object. All the Spectra objects within the SpcList object gets sorted according to the specified criteria.

Usage

1
2
## S4 method for signature 'SpcList'
sort(x, decreasing = FALSE, na.last = NA, which.col, ...)

Arguments

x

A SpcList 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

1
2
3
4
5
6
sp <- spc.example_spectra()
#Create an SpcList object (one separate Spectra object for each unique STATION)
spL <- spc.makeSpcList(sp,"STATION")
#Sort all Spectra objects with respect to their rows using the CAST column
spL.s <- sort(spL,which.col="CAST",decreasing=TRUE)
lapply(spL.s, function(x) as.character(x[["CAST"]]))

PranaGeo/Spectral documentation built on Feb. 21, 2020, 12:36 p.m.