I wrote a simulation in R that I want to visualize with brilliant now. I put the bulk of the simulation in the observation unit to evaluate it. During this evaluation process, that is, for each iteration, I want to build the current status. The question is how can I achieve this, since in my actual code the plot rendering is only performed after the main observer has been evaluated. Is there a way, for example, to suspend the execution of the monitoring unit and resume it after updating the schedule?
Shouldn't there be more functionality from brilliant to solve such a case, since I could imagine that I was not the only one who would like to do something like this?
It would be nice if you could help me :)
Below is the skeleton code for the server and ui.
ui.R:
library(shiny) shinyUI(pageWithSidebar( headerPanel("... Simulation"), sidebarPanel( sliderInput("epochs", "Number of Epochs:", min = 1, max = 100, value = 10), verbatimTextOutput("curr.iter"), actionButton("actionB", "Action!") ), mainPanel( plotOutput("distPlot") ) ))
server.R:
library(shiny) sinus <- data.frame() shinyServer(function(input, output) { dummy <- reactiveValues(iter=0) obsMain <- observe({ for (i in 1:input$epochs) { cat(i, " ") x <- seq(1:input$epochs) y <- sin(x) sinus <<- data.frame(x, y) dummy$iter <- i
r shiny
user3220352
source share