From 6677be01fdd66fcea91265b7ef90c54db364410b Mon Sep 17 00:00:00 2001 From: dmattek Date: Tue, 8 Oct 2019 12:51:38 +0200 Subject: [PATCH] Changed checks for NULL data to validate-need syntax. --- modules/aucPlot.R | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/modules/aucPlot.R b/modules/aucPlot.R index 67a9404..0d9dd37 100644 --- a/modules/aucPlot.R +++ b/modules/aucPlot.R @@ -125,12 +125,6 @@ modAUCplot = function(input, output, session, # Boxplot - display output$outPlotBox = renderPlot({ - locBut = input$butPlot - - if (locBut == 0) { - cat(file = stderr(), 'aucPlot:Go button not pressed\n') - return(NULL) - } plotBox() @@ -138,12 +132,6 @@ modAUCplot = function(input, output, session, output$outPlotBoxInt = renderPlotly({ - locBut = input$butPlot - - if (locBut == 0) { - cat(file = stderr(), 'aucPlot:Go button not pressed\n') - return(NULL) - } # This is required to avoid # "Warning: Error in : cannot open file 'Rplots.pdf'" @@ -180,13 +168,16 @@ modAUCplot = function(input, output, session, plotBox <- function() { cat(file = stderr(), 'aucPlot:plotBox\n') - loc.dt = in.data() + # make the f-n dependent on the button click + locBut = input$butPlot - cat(file = stderr(), "plotBox: on to plot\n\n") - if (is.null(loc.dt)) { - cat(file = stderr(), 'plotBox: dt is NULL\n') - return(NULL) - } + # Check if main data exists + # Thanks to solate all mods in the left panel are delayed + # until clicking the Plot button + loc.dt = isolate(in.data()) + validate( + need(!is.null(loc.dt), "Nothing to plot. Load data first!") + ) cat(file = stderr(), 'plotBox:dt not NULL\n') -- GitLab