[chronojump] R debugParameters can show booleans



commit 41fbfaf67114f1c0010b77549a0b02e43f875c91
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Feb 14 17:50:09 2017 +0100

    R debugParameters can show booleans

 encoder/util.R |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/encoder/util.R b/encoder/util.R
index 0b44f74..e42eda4 100644
--- a/encoder/util.R
+++ b/encoder/util.R
@@ -1347,7 +1347,7 @@ debugParameters <- function (parameterList, currentFunction)
        if(is.null(DEBUG) || DEBUG == FALSE || is.null(DebugFileName) || DebugFileName == "")
                return()
 
-        write(paste("Parameters of the", currentFunction, "function are:\n"), DebugFileName, append=TRUE)
+        write(paste("\n\n[Parameters of the", currentFunction, "function are]:\n"), DebugFileName, 
append=TRUE)
         
         #based on http://stackoverflow.com/a/34996874
         for (i in 1:length(parameterList)) {
@@ -1364,6 +1364,10 @@ debugParameters <- function (parameterList, currentFunction)
                        writedebugParameters(parameterList, i)
                         write(as.character(parameterList[[i]]), DebugFileName, append=TRUE)
                 }
+                else if (is.logical(parameterList[[i]])) {
+                       writedebugParameters(parameterList, i)
+                        write(as.character(parameterList[[i]]), DebugFileName, append=TRUE)
+                }
                 else if  (is.list(parameterList[[i]])) {
                        writedebugParameters(parameterList, i)
                         write_list(parameterList[[i]], DebugFileName, append = TRUE)
@@ -1389,11 +1393,13 @@ test_debugParameters <- function() {
         charVariable = c("Hello", "how", "are", "you")
         dataframeVariable = as.data.frame(matrix(c(10,20,40,50), ncol = 2))
         matrixVariable = matrix(c(100,200,400,500), ncol = 2)
+       booleanVariable = TRUE
 
        l = list(numVariable = numVariable,
                 charVariable = charVariable,
                 dataframeVariable = dataframeVariable,
-                matrixVariable = matrixVariable)
+                matrixVariable = matrixVariable,
+                booleanVariable = booleanVariable)
         
         debugParameters(l, "test_debugParameters")
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]