Skip to contents

Check if critical operators of R are not present in other packages or in the global env. Others functions of the R scope can be overwritten because safer functions always use :: when using any function.

Usage

.base_op_check(error_text)

Arguments

error_text

Single character string used to add information in error messages returned by the function, notably if the function is inside other functions, which is practical for debugging. Example: error_text = " INSIDE <PACKAGE_1>::<FUNCTION_1> INSIDE <PACKAGE_2>::<FUNCTION_2>.". If NULL, converted into "".

Value

An error message if at least one of the checked operator is present in the R scope, nothing otherwise.

Examples

if (FALSE)  # Example that shouldn't be run because this is an internal function (not found by devtools::check())
saferDev:::.base_op_check(error_text = " INSIDE fun1.") # nothing should happen
assign("!", 1) ; assign("+", 2) ; saferDev:::.base_op_check(error_text = " INSIDE fun1.") # this example returns an error
rm("!") ; rm("+")