6.3.corrections {pems.utils} | R Documentation |
Corrections
Description
Corrections are a special subset of functions which by default write over the elements that they recalculate.
Usage
correctInput(input = NULL, ..., data = NULL,
correction = NULL)
zeroNegatives(input = NULL, ..., data = NULL,
screen = FALSE)
correctBaseline(x, ..., data = NULL, output = "ans")
#associated
calcPack2(input, ..., settings = NULL, data = NULL)
Arguments
input |
(Required data series typically vectors) The input to use when makin a correction. This
is typically a vector or element in either a |
x |
(For |
... |
(Optional) Other arguments, typically passed on. |
data |
(Optional |
correction |
(For |
screen |
(For |
output |
(character) Where options exists for the function output, the required output. For
|
settings |
(For |
Details
correctInput
is a general correction handlers. It accepts an
input
and a function, correction
, which it applies to
input
.
zeroNegatives
resets any negative values in an input
to
zero.
correctBaseline
attempts to correct the baseline of a supplied data
(pems.element
vector
) time-series. Baseline corrections are
carried out using methods from the baseline
package. See Below.
calcPack2
is an alternative version of calcPack
. See
associated help for details.
Value
With the exception of calcPack2
, all the above functions generate
input corrections.
correctBaseline
returns the supplied data time-series (x
) after applying the
requested baseline correction (see below).
Note
By default, corrections return results in the format of the input
. So: If
inputs are supplied as vectors, the answer is returned as a vector; If inputs are
supplied in a pems
object, that pems
object is returned with the answer
added in. This behaviour is enabled by the default output = "special"
. Output
type can be forced by declaring ouput
in the function call. Options
"input"
, "data.frame"
and "pems"
return vectors, data.frames and
pems objects, respectively.
Unlike other calculations, corrections automatically replace the associated
input
, unless prevented (using overwrite = FALSE
).
This function management is handled by calcChecks
and
calcPack
. These are front and back end calc...
function add-ins that anyone can use as a 'minimal code' means of
integrating third-party and pems.utils
functions.
See calcChecks
documentation for details.
correctBaseline
is a recent transfer from sleeper.service
.
It uses baseline
functions to provide 'best guess' baseline
corrections.
By default, it applies:
baseline(..., method="rollingBall", wm=50, ws=50)
Please Note the 'best guess': As baseline corrections are based statistical estimates of likely baselines rather than actual measures of drift these should be treated as estimates.
Unit management is by convertUnits
. See associated help
documentation for details.
Author(s)
Karl Ropkins
References
baseline:
Kristian Hovde Liland and Bjorn-Helge Mevik (2015). baseline: Baseline Correction of Spectra. R package version 1.2-1. https://CRAN.R-project.org/package=baseline
See Also
baseline
regarding baseline corrections.
common.calculations
, calcVSP
or calcEm
for calculation functions.
getElement
(checkUnits, etc
and convertUnits
for data management.
Examples
###########
##example 1
###########
#basic usage
zeroNegatives(-10:10) #etc