[chronojump] R debugParameters can process lists
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] R debugParameters can process lists
- Date: Mon, 13 Feb 2017 18:55:29 +0000 (UTC)
commit d13303e931cb797afa02f8356b7f37049e6c3e2d
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon Feb 13 19:54:01 2017 +0100
R debugParameters can process lists
encoder/util.R | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/encoder/util.R b/encoder/util.R
index 4dd4489..028c83f 100644
--- a/encoder/util.R
+++ b/encoder/util.R
@@ -1327,6 +1327,21 @@ cvPar <- function(x, y, parRange, cvProp = 0.8) {
#----------- end spar with crossvalidation -------------
#----------- Begin debug file output -------------
+#http://stackoverflow.com/a/34996874
+write_list <- function (outlist, outfile,append=FALSE) {
+ for (i in 1:length(outlist)) {
+ if (i==1) app=append else app=TRUE
+ if (is.character(outlist[[i]]) || is.numeric(outlist[[i]])) write(paste(outlist[[i]],collapse
= " "),outfile, append=app)
+ else
+ if (is.data.frame(outlist[[i]])) write.table(outlist[[i]],outfile, append=app,
quote=FALSE, sep="\t")
+ else
+ if (is.POSIXlt(outlist[[i]])) write (as.character(outlist[[i]]),outfile,
append=app)
+ else
+ if (is.list(outlist[[i]])) write_list(outlist = outlist[[i]],
outfile, append = TRUE)
+
+ }
+}
+
debugParameters <- function (parameterList, currentFunction)
{
if(is.null(DEBUG) || DEBUG == FALSE || is.null(DebugFileName) || DebugFileName == "")
@@ -1351,7 +1366,7 @@ debugParameters <- function (parameterList, currentFunction)
}
else if (is.list(parameterList[[i]])) {
writedebugParameters(parameterList, i)
- write_list(parameterList = parameterList[[i]], DebugFileName, append = TRUE)
+ write_list(parameterList[[i]], DebugFileName, append = TRUE)
}
else if (is.matrix(parameterList[[i]])) {
writedebugParameters(parameterList, i)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]