Description Usage Arguments Details Value See Also
View source: R/param_setters.R
convertParams
defines the rules how variables meeting user-defined
conditions shall be converted (most often, coerced).
... |
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. |
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
.
convertParams
returns a named list of conversion rules.
The list has a special class "convertParams".
autoConvert
for examples
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.