spc.lapply: Apply a function over a Spclist

Description Usage Arguments Value Examples

Description

lapply returns a list of the same length as X, each element of which is the result of applying FUN to the corresponding element of X.

Usage

1
2
3
4
spc.lapply(X, FUN, ...)

## S4 method for signature 'SpcList'
spc.lapply(X, FUN, ...)

Arguments

X

A SpcList object .

FUN

function to be applied to each element of X.

...

optional arguments to FUN.

Value

list or SpcList object.

Examples

1
2
3
4
5
6
7
 
sp=spc.example_spectra()
BL=spc.makeSpcList(sp,"CAST")
#Counts rows (returns a list object)
spc.lapply(BL,function(x) {nrow(x)})
#Perform arithmetic operations on all Spectra elements. Returns a SpcList object.
spc.lapply(BL,function(x) {x^2+1})

geoSpectral documentation built on Feb. 20, 2020, 5:08 p.m.