From 268805de4937845f7d2fb020cafb513d29cfaeeb Mon Sep 17 00:00:00 2001 From: stwirth Date: Mon, 15 Jan 2018 15:31:01 +0100 Subject: [PATCH] Changed how ignored data is printed in validationpdf.R --- DESCRIPTION | 4 ++-- R/validationpdf.R | 24 ++++++++++++++++++------ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 12e7e46..18708a6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: mip Type: Package Title: Comparison of multi-model runs -Version: 0.97.3 -Date: 2017-10-06 +Version: 0.98.0 +Date: 2018-01-15 Author: David Klein, Benjamin Leon Bodirsky, Florian Humpenoeder, Lavinia Baumstark, Jerome Hilaire Maintainer: David Klein Description: Package contains generic functions to produce comparison plots of multi-model runs. diff --git a/R/validationpdf.R b/R/validationpdf.R index 121321a..4125eae 100644 --- a/R/validationpdf.R +++ b/R/validationpdf.R @@ -328,14 +328,26 @@ validationpdf <- function(x,hist,file="validation.pdf",style="comparison", only_ } if(!is.null(stats$ignored_all0)) { swlatex(sw,"\\section{Ignored data}") - if(!is.null(stats$ignored_all0$x)) { - swlatex(sw,"Data contains only a mix of 0 and NA values and is ignored.") - swR(sw,cat,stats$ignored_all0$x,sep="\n") + if(!is.null(stats$ignored_all0$x) && !is.null(stats$ignored_all0$hist)) { + swlatex(sw, "Variables of data and validation data that only contain a mix of 0 and NA values and are ignored.") + swR(sw, cat, intersect(stats$ignored_all0$x, stats$ignored_all0$hist), sep="\n") } - if(!is.null(stats$ignored_all0$hist)) { - swlatex(sw,"Validation data contains only a mix of 0 and NA values and is ignored.") - swR(sw,cat,stats$ignored_all0$hist,sep="\n") + if(!is.null(stats$ignored_all0$x)){ + swlatex(sw, "Data contains only a mix of 0 and NA values and is ignored, but validation data contains other values.") + swR(sw, cat,setdiff(stats$ignored_all0$x, stats$ignored_all0$hist) ,sep="\n") } + if(!is.null(stats$ignored_all0$hist)){ + swlatex(sw, "Validation data contains only a mix of 0 and NA values and is ignored, but data contains other values.") + swR(sw, cat,setdiff(stats$ignored_all0$hist, stats$ignored_all0$x) ,sep="\n") + } + # if(!is.null(stats$ignored_all0$x)) { + # swlatex(sw,"Data contains only a mix of 0 and NA values and is ignored.") + # swR(sw,cat,stats$ignored_all0$x,sep="\n") + # } + # if(!is.null(stats$ignored_all0$hist)) { + # swlatex(sw,"Validation data contains only a mix of 0 and NA values and is ignored.") + # swR(sw,cat,stats$ignored_all0$hist,sep="\n") + # } } if(length(xtrax)>0 | length(xtrahist)>0) { swlatex(sw,"\\section{Non-Matching Data}")