Skip to contents


library(saferDev)


Datasets

fun1 <- function(){
    base::sum(1, 3)
  }

fun2 <- function(){
    sum(1, 3)
  }


Datasets info

fun1
> function(){
>     base::sum(1, 3)
>   }
fun2
> function(){
>     sum(1, 3)
>   }


Argument x

colons_check(x = fun1) # a function name, written without quotes and brackets
> 
> 
> AFTER RUNNING saferDev::colons_check().
> INSIDE fun1(), EVERYTHING SEEMS CLEAN.
colons_check(x = fun2) # a function name, written without quotes and brackets
> 
> 
> INSIDE fun2(), SOME :: OR ::: ARE MISSING BEFORE BASIC FUNCTIONS:
> 
> LINE  FUN     STRING_BEFORE
> 2 sum     


Argument safer_chek

colons_check(
    x = fun1, 
    afer_check = FALSE
) # Single logical value. Perform some "safer" checks (see https://github.com/safer-r) ?
> Error in colons_check(x = fun1, afer_check = FALSE): unused argument (afer_check = FALSE)


All the arguments

colons_check(
    x = fun1, # a function name, written without quotes and brackets
    safer_check = TRUE, # perform some "safer" checks? Warning : always set this argument to FALSE if all_args_here() is used inside another safer function.
    lib_path = NULL, # absolute pathways of the directories containing the required packages if not in the default directories.
    error_text = "" # add information in error messages returned by the function.
)
> 
> 
> AFTER RUNNING saferDev::colons_check().
> INSIDE fun1(), EVERYTHING SEEMS CLEAN.


Sophisticated example

source("https://raw.githubusercontent.com/safer-r/saferDev/main/dev/other/test.R")
colons_check(
    x = test, # a function name, written without quotes and brackets
    safer_check = TRUE # Single logical value. Perform some "safer" checks (see https://github.com/safer-r) ?
)
> 
> 
> INSIDE test(), SOME :: OR ::: ARE MISSING BEFORE BASIC FUNCTIONS:
> 
> LINE  FUN     STRING_BEFORE
> 5 gregexpr        matches <- 
> 8 regmatches      matched_strings <- 
> 11    sum     
> 18    sub     result <- 
> 19    range       
> 22    return      
> 
> INSIDE test(), INTERNAL FUNCTION DETECTED:
> FUN1
> 
> INSIDE test(), SOME :: OR ::: ARE MISSING BEFORE OTHER FUNCTIONS:
> 
> LINE  FUN     STRING_BEFORE
> 16    roc1        base::length(
> 20    roc4        tempo.cat <- base::paste0("IAGE\nLENGTHS OF roc00() (", base::ks.test(