saferDev
saferDev.RmdDescription
Set of functions for the development of R functions and pipelines, written according to the safer-R project specifications.
Content
| Function | Description |
|---|---|
| all_args_here() | Check that all the functions used inside a function are
written with all their arguments. For instance:
base::paste0(letters[1:2], collapse = NULL, recycle0 = FALSE)
and not base::paste0(letters[1:2]). Return table message of
the line with problems and a corrected version of the submitted
function. |
| arg_check() | Check expected values of arguments of functions: class, type, mode, length (each tested exactly, same values, in the same order), restricted values panel, kind of numeric values in addition to the distinction between ‘integer’ and ‘double’ (proportion only? Inf values authorized? negative values authorized? Integers of type ‘double’?). |
| colons_check() | Check that all the functions used inside a function are
all referenced by their package attribution. For instance:
base::mean() and not mean(), or
saferDev:::.base_op_check() and not
.base_op_check(). Return table message of the line with
problems and a corrected version of the submitted function. |
| curly_bracket_check() | Verify that all the bodies of the if,
else, for, while,
repeat and function are delimited by curly
brackets { }. Return table message of the line with
problems and a corrected version of the submitted function. |
| for_loop_nb_check() | Check the sequence expression of every for
loop of a function. If the number of iterations is not fixed by the
writing itself (e.g., 1:length(x)), a checking line is
added before the loop, issuing a warning at execution if the sequence is
empty, contains NA or infinite values, has a single value,
or is decreasing. Return a table-like message of the problematic lines
and a corrected version of the submitted function. |
| env_check() | Verify that object names in the environment defined by
the pos argument are identical or not to object names in
the above environments (following R Scope). This can be used to verify
that names used for objects inside a function or in the working
environment do not override names of objects already present in the
above R environments, following the R scope. |
| get_message() | Return the error, warning or simple (non error non warning) message if ever exist of an instruction written between quotes. |
| is_function_here() | Check if required functions are present in installed packages. This controls for instance modifications of function names depending on package versions. |
| is_package_here() | Check if required packages are installed locally. |
| report() | Print a character string or a data object into a same log file. |
| true_false_check() | Verify that the TRUE and
FALSE logical constants are always written in full when
used as values (argument values, conditions, comparisons, indexing) and
never abbreviated as T or F, which can be
overwritten by the user. Return table message of the line with problems
and a corrected version of the submitted function. |