How to run user input as R code in a Shiny app?

I want to create a brilliant application that has input for writing some function or R command, reads it through ui.R, then passes it to the server. R, which executes this R. command to display the results.

I spent hours searching for some examples, but I couldn’t find anything, I already know how to create Shiny applications using ui and server and transfer input values ​​to the server and work with them, but I have no idea if it's possible to create a brilliant application, like R, where you can write commands and return results, any example or help would be appreciated.

+4
source share
1 answer

- , . shinyjs Dean Attali.

:

  library(shiny)
  library(shinyjs)

  shinyApp(
    ui = fluidPage(
      useShinyjs(),  # Set up shinyjs
      runcodeUI(code = "shinyjs::alert('Hello!')")
    ),
    server = function(input, output) {
      runcodeServer()
    }
  )

, :

:

shinyjs::alert(ls(globalenv()))

shinyjs::alert(list.files())
+6

Source: https://habr.com/ru/post/1682395/


All Articles