convertParams: Setting the parameters for auto-conversion

Description Usage Arguments Details Value See Also

View source: R/param_setters.R

Description

convertParams defines the rules how variables meeting user-defined conditions shall be converted (most often, coerced).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

Arguments

...

named definitions of new rules, each being a named list of 'IF', 'DO', and 'EVAL' elements. See the pre-defined rules below and the Details section for further information. Note that the argument name "ANY" is reserved for internal use.

factor, integer, double, character

pre-defined rules for the most standard object types. See Details.

Details

convertParams defines a collection of conversion rules. A rule is a named list of three elements: 'IF', 'DO', and 'EVAL'.
'IF' defines the condition which triggers the conversion; it is a function or a character string denoting a function (e.g., "is.integer") which accepts at least one argument (the data which should be converted). It must return a single logical value (TRUE or FALSE).
'DO' is a list of potential conversion procedures, that is, functions or character strings denoting the functions. During conversion, the functions in 'DO' are called in the given order and their returned values are compared to the original data as defined in 'EVAL' (see later). Therefore, each function should accept at least one argument (the data), and all functions should return an object which is accepted by 'EVAL'. Usually, functions in 'DO' return a vector of the same length as the input data; a typical example could be as.logical.
'EVAL' is a single function or a character string denoting a function which is used to evaluate whether the conversion resulted in an acceptible return value. Therefore, an 'EVAL' function must accept at least two arguments: the original data and the returned value of a 'DO' function. Note that the order of arguments is important. Additionally, the 'EVAL' function must return a single logical value: TRUE if the conversion is acceptible, and FALSE if it is not. Usually, the 'EVAL' function is a counterpart of the 'IF' function, e.g. as.integer.

Value

convertParams returns a named list of conversion rules. The list has a special class "convertParams".

See Also

autoConvert for examples


tdeenes/eegR documentation built on April 19, 2021, 4:17 p.m.