getSag | R Documentation |
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.
getSag(dataAbs, waveCol, sag, colSubsetString, dataSummary, grnum)
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. |
dataSummary dataframe with the additional columns containing spectral slopes as defined in sag for each sample (e.g., GRnumber).
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.