spectralAnalysis v3.12.0


Monthly downloads



Pre-Process, Visualize and Analyse Process Analytical Data, by Spectral Data Measurements Made During a Chemical Process

Infrared, near-infrared and Raman spectroscopic data measured during chemical reactions, provide structural fingerprints by which molecules can be identified and quantified. The application of these spectroscopic techniques as inline process analytical tools (PAT), provides the (pharma-)chemical industry with novel tools, allowing to monitor their chemical processes, resulting in a better process understanding through insight in reaction rates, mechanistics, stability, etc. Data can be read into R via the generic spc-format, which is generally supported by spectrometer vendor software. Versatile pre-processing functions are available to perform baseline correction by linking to the 'baseline' package; noise reduction via the 'signal' package; as well as time alignment, normalization, differentiation, integration and interpolation. Implementation based on the S4 object system allows storing a pre-processing pipeline as part of a spectral data object, and easily transferring it to other datasets. Interactive plotting tools are provided based on the 'plotly' package. Non-negative matrix factorization (NMF) has been implemented to perform multivariate analyses on individual spectral datasets or on multiple datasets at once. NMF provides a parts-based representation of the spectral data in terms of spectral signatures of the chemical compounds and their relative proportions. The functionality to read in spc-files was adapted from the 'hyperSpec' package.

Functions in spectralAnalysis

Name Description
getStartTime generic function to extract startTime-slot
localBaselineCorrect local baseline correct, substract a baseline either trough 1 or 2 points
nonNegativePreprocessing condition datamatrix to input in and condition properly for NMF
getProcessTimesFrameExample get mimimal example ProcessTimesFrame-class
getRange generic function to extract range-slot
getTimeConversionFactor transform timeUnit to convert from seconds to specified unit
initializeNMFModel Initialize NMF model with initial spectral data
preprocessSpectraInTimeWithList internal function to wrap multiple preprocessing steps
r create a RangeToSubset-class object from 2 elements or from a vector
last return laste element( of a vector )
e Create an ElementsToSelect-class from a numeric vector or multiple numeric values or vectors
upsampleNMFResult Upsample NMF result to original temporal resolution
wavelengthAlign Align SpectraInTime objects with differing wavelength axes to a common wavelength axis using cubic spline interpolation.
spectralNMFList Perform Non-Negative Matrix factorization on list of SPC files
spectralNormalization normalization function
normalize generic normalization function
setExperimentName<- set the experiment name
SpectraInTime-class SpectraInTime-class (time resolved spectra ) wavelength-time data for 1 experiment
plotlyAxis help function to make plotly axis title
getExtraInfo generic function to extract extraInfo-slot
setTimePointsAlt<- set time alternative time axis
subset-methods Subsetting SpectraInTime-class
spectralSmoothAndDifferentiate internal smoothing and differentiation function
SummaryByWavelengths-class S4-class for summary object SpectraInTime
getListOfSpectraExample get example list of spectra
getPreprocessing generic function to extract preprocessing-slot
getDefaultSumFunc function to get default summary functions
getWavelengths generic function to extract wavelengths-slot
getProcessTimesExample get a minimal ProcessTimes-class example based on getSpectraInTimeExample
computeNMFResidu Compute relative residual per observation of an NMF fit to a spectral data set
includeRedundantSources Re-introduce redundant source vectors and corresponding zero abundances into final NMF result
getDefaultTimeFormat function to get default time format in the package
getPathProcessTimesExample example path process times ecport
readProcessTimes read .csv file as process times
getNMFInputMatrix Extract spectral input matrix from SPC file and condition properly for NMF
lastSpectrum Get the last spectrum
convertListToS4 convert an a named list to S4 object
readSPC Read-in of a SPC file.
first return first element (of a vector)
firstSpectrum Get the first spectrum
removeRedundantSources Remove redundant sources from the initial NMF model
loadAllSPCFiles Load all or a selection of SPC files from a given directory.
spectralAnalysis spectralAnalysis: a package to read-in, pre-process, visualise and analyse spectral data
runNMF Actual NMF analysis
spectralIntegration Integrate spectraInTime object
getSpectra generic function to extract spectra-slot
trapz integration via trapezium ruls originally from caTools package, included to avoid dependency on old package with correction inverse scale, should give still possitive values (taken absolute values )
smooth generic smoothing function
timeAlign.listOfSpectra Align all spectra in a list
getUnits generic function to extract units-slot
getSpectraInTimeExample Artificial example SpectraInTime-class
getTimePoints generic function to extract timePoints-slot
predictNNLS Based on previously obtained NMF result NMFResult, estimate coefficients for a new spectralData object object using non-negative least squares fitting. The result is returned as as an NMF model.
spectralNMF Perform Non-Negative Matrix factorization on spectral data
preprocess generic function to preprocess an S4 object
timeAlign Time align first object, using info in the second object
timeAlign.SpectraInTime align 1 SpectraInTime with 1 cooling information
saveSpectra save a SpectraInTime-class as a .txt file
scaleNMFResult Apply fixed scaling to NMF model matrices by normalizing the basis vectors
testListOfSpectra internal function to check all elements are spectraInTime
subset.SpectraTime internal function for subsetting
ElementsToSelect-class Elements S4 class useful for closest elements subsetting
ProcessTimesFrame-class S4 Class key process times in a data frame, every line is convertable to a ProcessTimes-class
ProcessTimes-class S4 Class key process times
RangeToSubset-class Range S4 class (range) useful for subsetting with actual values instead of indicators
baselineCorrect generic function to perfom baseline correction
changeDevSettings Function to overwrite default settings, print to console when changing default settings and add to default settings
checkIdenticalClass check wether all elements of of the same class
addMessage add an message to list of messages for printing #
checkCompatible Check whether 2 objects are compatible before using them together For instance, same experiment name and matching time frames
checkMethod check method in list of allowd method
completeSourceMatrix complete source matrix
addPreprocessingStep function to use by preprocessing step
checkTimeUnit check timeeUnit and produce error if not correct unit
checkForRedundantSources Check if any of the source vectors in the initialized NMF model are redundant, and should be omitted from the actual NMF analysis
convertS4ToList convert an S4 object into a list
getElements generic function to extract elements-slot
flagVectorInInterval flag vector elements within interval (closed interval )
getExperimentName generic function to extract experimentName-slot
getClosestElements get closest element for elements looked up in a vector
No Results!

Last month downloads


Type Package
LazyData true
URL http://www.openanalytics.eu
License GPL-3
Collate 'internalHelpers.R' 'allGenericFunctions.R' 'objectSpectraInTime.R' 'objectProcessTimes.R' 'objectLinking.R' 'alignmentFunctions.R' 'dataManagementTools.R' 'defaults.R' 'readSPC.R' 'saveSpectraInTime.R' 'spectralAnalysis.R' 'spectralIntegration.R' 'spectralNMF.R' 'spectralPreprocessing.R' 'spectralVisualization.R' 'subsetting.R'
NeedsCompilation no
Packaged 2018-06-11 10:37:24 UTC; ablommaert
Repository CRAN
Date/Publication 2018-06-12 14:30:39 UTC

Include our badge in your README