Learn R Programming

spectralAnalysis (version 3.12.0)

smooth: generic smoothing function

Description

generic smoothing function

smoothing is applied in the wavelength domain, not in the time domain

Usage

smooth(object, ...)

# S4 method for SpectraInTime smooth(object, method = "sg", order = 3, window = order + 3 - order%%2, derivative = 0)

Arguments

object

a S4 class object

...

additional parameters

method

character vector smoothing method, default = 'sg', i.e Savitsky-Golay filter. currently only implemented smoothing method

order

numeric value, order of the polynomial used to interpolate, should be larger than derivative order, defaults to 3 + derivative

window

width of the smoothing

derivative

derivative to be taken, defaults to 0

Examples

Run this code
# NOT RUN {
     spectralEx     <-  getSpectraInTimeExample()
    smoothDefault   <-  smooth( spectralEx )
    timeRange       <-  range( getTimePoints( spectralEx ))
    timesToSelect   <-  e( seq( timeRange[1] , timeRange[2] , length.out = 5  )  )
    # plot( smoothDefault  )
    # plot( smoothDefault[ timesToSelect , ] , type = "time")
    smoothALot      <-  smooth( spectralEx ,  order = 2 , window = 301  ) 
    # plot( smoothALot )
    # plot( smoothALot[  timesToSelect , ] , type = "time" )
    derivative1     <-  smooth( spectralEx , derivative = 1 )
    # plot( derivative1 )
    # plot( derivative1[  timesToSelect ,] , type = "time" )
    
    derivative2     <-  smooth( spectralEx , derivative = 2 )
    # plot(  derivative2 )
    # plot( derivative2[  timesToSelect , ] , type = "time" )
    
# }

Run the code above in your browser using DataLab