getSag: getSag

View source: R/SSmultiFxn.R

getSagR Documentation

getSag

Description

Computes spectral slopes from absorbance data using a linear regression to determine the first order decay function as defined in Helms et al. 2008, Limnol. Oceanogr., 53(3), 955-969. aL = aRef * exp(-S*(L-LRef)) where a = absorbance coefficient, S = specral slope, and L = wavelength.

Usage

getSag(dataAbs, waveCol, sag, colSubsetString, dataSummary, grnum)

Arguments

dataAbs

dataframe with absorbance spectra results, one column per sample, and one column containing the wavelength at which an absorbance measurment is made.

waveCol

column name as character to define the wavelengths (as integer) for which absorbance was measured

sag

dataframe with three columns. The first column represents the low wavelength (as integer), the second column represents the high wavelength (as integer) for which spectral slopes are to be defined, and the third column is the variable name to be used (as factor). A spectral slope is computed for each row.

colSubsetString

unique characters to identify which columns contain absorbance data. The default is "gr" to comply with the common naming from the CA WSC. The sample names must begin with 1-n characters for the function to work.

dataSummary

dataframe with summary absorbance and fluorescence data. This function adds columns to the end of this dataframe as additional summary data.

grnum

character column name that defines the column with sample names in the dataSummary dataframe. These names are used to merge spectral slope data into the summary dataframe.

Value

dataSummary dataframe with the additional columns containing spectral slopes as defined in sag for each sample (e.g., GRnumber).

Examples

dataAbs <- dfabs
waveCol <- "wavelengths"
sag <- dfsags
colSubsetString <- "gr"
dataSummary <- dfsummary
dataSummary <- dataSummary[,-c(64:67)] #remove columns with spectral slopes and re-compute with this function
grnum <- "GRnumber"
testSag <- getSag(dataAbs,waveCol,sag,colSubsetString,dataSummary,grnum)

USGS-R/USGSHydroOpt documentation built on Oct. 18, 2022, 9:50 a.m.