From f202a6468c0f223017661b23ec47907034297807 Mon Sep 17 00:00:00 2001
From: gmillot <gael.millot@pasteur.fr>
Date: Tue, 17 Jul 2018 15:49:42 +0200
Subject: [PATCH] 3rd commit

---
 README.md           | 4 ++--
 r_debugging_tools.R | 8 +++++---
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md
index a8bb758..b4ddcfa 100644
--- a/README.md
+++ b/README.md
@@ -3,6 +3,6 @@ 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:
+WHAT'S NEW IN v1.2:
 
-1) printing result improvment
+1) printing result improvement
diff --git a/r_debugging_tools.R b/r_debugging_tools.R
index 9a28537..84a397c 100644
--- a/r_debugging_tools.R
+++ b/r_debugging_tools.R
@@ -1,6 +1,6 @@
 ################################################################
 ##                                                            ##
-##     R DEBUGGING TOOLS v1.1                                  ##
+##     R DEBUGGING TOOLS v1.2                                  ##
 ##                                                            ##
 ##     Gael A. Millot                                         ##
 ##                                                            ##
@@ -16,9 +16,10 @@ str_basic_arg_check_dev <- '
 # NULL argument default value
 # argument without default values
 # STRING
+function.name <- as.list(match.call(expand.dots=FALSE))[[1]]
 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\n================================\n\n", function.name," FUNCTION ARGUMENT CHECKING\n\n================================\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))){
@@ -40,6 +41,7 @@ str_arg_check_with_fun_param_check_dev <- '
 # string that check:
 # which arguments have been checked using fun_param_check()
 # STRING
+function.name <- as.list(match.call(expand.dots=FALSE))[[1]]
 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)
 if( ! any(ls() %in% "checked.arg.names")){
     cat(paste0("\n\n================\n\nERROR: MISSING checked.arg.names OBJECT. ARGUMENTS MAY HAVE NOT BEEN CHECKED USING fun_param_check(). SEE THE fun_export_data() FUNCTION FOR THIS KIND OF CHECKING\n\n================\n\n"))
@@ -47,7 +49,7 @@ if( ! any(ls() %in% "checked.arg.names")){
 if( ! find("fun_param_check") == ".GlobalEnv"){
     cat(paste0("\n\n================\n\nERROR: MISSING fun_param_check() FUNCTION IN THE GLOBAL ENVIRONMENT. ARGUMENTS MAY HAVE NOT BEEN CHECKED USING fun_param_check(). SEE THE fun_export_data() FUNCTION FOR THIS KIND OF CHECKING\n\n================\n\n"))
 }
-cat(paste0("\n\n================================\n\nARGUMENT CHECKING USING fun_param_check()\n\n================================\n"))
+cat(paste0("\n\n================================\n\n", function.name," FUNCTION ARGUMENT CHECKING USING fun_param_check()\n\n================================\n"))
 if(any(duplicated(checked.arg.names))){ # for function debbuging
 cat(paste0("\n================\nTHESE ARGUMENTS ARE DUPLICATED IN CHECK USING fun_param_check(): ", paste(checked.arg.names[duplicated(checked.arg.names)], collapse = " ")))
 }
-- 
GitLab