From 1fcf46e8ef3d7a6a6291869b1821d100bcc1217a Mon Sep 17 00:00:00 2001 From: dmattek Date: Thu, 10 Oct 2019 17:25:53 +0200 Subject: [PATCH] Fixed: no mean line if NAs present --- modules/trajRibbonPlot.R | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/trajRibbonPlot.R b/modules/trajRibbonPlot.R index f85e6fd..f01c0ed 100644 --- a/modules/trajRibbonPlot.R +++ b/modules/trajRibbonPlot.R @@ -313,7 +313,7 @@ modTrajRibbonPlot = function(input, output, session, if(input\$rBPlotTrajStat == "Mean") { # calculate the mean - loc.dt.aggr = loc.dt[, .(Mean = mean(get(COLY))), by = c(in.facet, COLRT)] + loc.dt.aggr = loc.dt[, .(Mean = mean(get(COLY), na.rm = T)), by = c(in.facet, COLRT)] } else if(input\$rBPlotTrajStat == "CI") { # calculate the mean and the confidence intervals @@ -326,9 +326,10 @@ modTrajRibbonPlot = function(input, output, session, } else if(input\$rBPlotTrajStat == "SE") { # calculate the mean and the standard error of the mean - loc.dt.aggr = loc.dt[, .(Mean = mean(get(COLY)), - Lower = mean(get(COLY)) - LOCstderr(get(COLY)), - Upper = mean(get(COLY)) + LOCstderr(get(COLY))), by = c(in.facet, COLRT)] + loc.dt.aggr = loc.dt[, .(Mean = mean(get(COLY), na.rm = T), + Lower = mean(get(COLY), na.rm = T) - LOCstderr(get(COLY), na.rm = T), + Upper = mean(get(COLY), na.rm = T) + LOCstderr(get(COLY), na.rm = T)), + by = c(in.facet, COLRT)] loc.ribbon.lohi = c('Lower', 'Upper') } -- 2.26.2