evalCode
tries to evaluate code given as a sting. In case of an error, a
modal pops up showing the resulting error message.
evalCode(code, env = parent.frame())
code | A |
---|---|
env | The environment where the code should be evaluated. Defaults to the calling environment. |
The result of the specified expression or NULL
in case of an error
if (FALSE) { shinyApp( fluidPage( textAreaInput("code", "code", "# intended typo\nrnrm(100)"), actionButton("evaluate", "evaluate"), verbatimTextOutput("result") ), function(input, output, session){ res <- eventReactive( input$evaluate, evalCode(input$code) ) output$result <- renderPrint(res()) } ) }