Corrections

Share:

Description

Corrections are a special subset of calculations which by default write over the elements that they recalculate.

Usage

1
2
3
4
5
6
7
8
9
correctInput(input = NULL, ..., data = NULL,
         correction = NULL)

zeroNegatives(input = NULL, ..., data = NULL, 
         screen = FALSE)

#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 data.frame or pems object.

...

(Optional) Other arguments, typically passed on.

data

(Optional data.frame or pems object) The data source if either a data.frame or pems object is being used.

correction

(For correctInput, required function) The correction operation to apply to input. This is typically a function or function name (as character string).

screen

(For zeroNegatives, logical) If the user intends screening the correction before applying it, this should be set to TRUE.

settings

(For calcPack2, list) Any arguments to be used as settings when handling pems.elements. Unless developing functions, this can typically be ignored.

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.

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.

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.

Unit management is by convertUnits. See associated help documentation for details.

Author(s)

Karl Ropkins

References

References in preparation.

See Also

common.calculations, calcVSP or calcEm for calculation functions.

getElement (checkInput if passing elements as inputs), checkUnits and convertUnits for data management.

Examples

1
2
3
4
5
6
7
###########
##example 1 
###########

#basic usage

zeroNegatives(-10:10) #etc