From 9d62e6d666904cfa9f1d4b13894321b22fef667a Mon Sep 17 00:00:00 2001 From: gmillot <gael.millot@pasteur.fr> Date: Tue, 17 Jul 2018 15:33:36 +0200 Subject: [PATCH] 2nd commit --- README.md | 4 ++++ r_debugging_tools.R | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a5a4475..a8bb758 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,7 @@ Download the desired Tagged version, never the current master. Source the cute_little_functions.R into R/RStudio to have the functions available in the working environment. + +WHAT'S NEW IN v1.1: + +1) printing result improvment diff --git a/r_debugging_tools.R b/r_debugging_tools.R index 609b126..9a28537 100644 --- a/r_debugging_tools.R +++ b/r_debugging_tools.R @@ -1,6 +1,6 @@ ################################################################ ## ## -## R DEBUGGING TOOLS v1.0 ## +## R DEBUGGING TOOLS v1.1 ## ## ## ## Gael A. Millot ## ## ## @@ -19,7 +19,7 @@ str_basic_arg_check_dev <- ' default.arg.list <- formals(fun = sys.function(sys.parent(n = 2))) # list of all the arguments of the function with their default values (not the values of the user !). Use n = 2 when he string has to be evaluated by eval() inside a function. Use n=1 (default) if not evaluation. It seems that ls() as first line of the function provide the names of the arguments (empty, called, etc., or not) arg.without.default.value <- sapply(default.arg.list, is.symbol) & sapply(sapply(default.arg.list, as.character), identical, "") # logical to detect argument without default values (these are typeof "symbol" and class "name" and empty character cat(paste0("\n\n================================\n\nARGUMENT CHECKING\n\n================================\n")) -cat(paste0("\n================\nARGUMENTS OF THE FUNCTION ARE (INCLUDING DEFAULT VALUES):\n")) +cat(paste0("\n================\nARGUMENTS OF THE FUNCTION ARE (INCLUDING DEFAULT VALUES):\n\n")) print(default.arg.list) if(any(sapply(default.arg.list, FUN = is.null))){ cat(paste0("\n================\nNULL ARGUMENTS ARE: ", paste(names(default.arg.list)[sapply(default.arg.list, FUN = is.null)], collapse= " "))) @@ -31,7 +31,7 @@ cat(paste0("\n================\nARGUMENTS WITHOUT DEFAULT VALUES ARE: ", paste(n }else{ cat(paste0("\n================\nNO ARGUMENTS WITHOUT DEFAULT VALUES")) } -cat(paste0("\n================\n")) +cat(paste0("\n================\n\n")) # END STRING ' @@ -56,7 +56,7 @@ cat(paste0("\n================\nTHESE ARGUMENTS HAVE NOT BEEN CHECKED WITH fun_p }else{ cat(paste0("\n================\nALL THE ARGUMENTS HAVE BEEN CHECKED USING fun_param_check()")) } -cat(paste0("\n================\n")) +cat(paste0("\n================\n\n")) # END STRING ' -- GitLab