I'm trying to figure out how to get R to interact through brilliant with other javascript elements, which I assume means that server.R serves a custom brilliant object (perfectly json formatted?) To ui.R , which then converts to a javascript array. Code of my work in progress:
server.R
library(shiny) shinyServer( function(input, output) { output$species_table <- renderTable({ iris[iris$Species == input$species,] }) output$json <- RJSONIO::toJSON(iris[iris$Species == input$species,], byrow=T, colNames=T)
ui.R
require(shiny) specs = as.character(unique(iris$Species)) names(specs) = specs pageWithSidebar( headerPanel("minimal json handling example"), sidebarPanel(selectInput("species", "Species", specs)), mainPanel( tableOutput("species_table") ) )
What server error returns:
Error in .getReactiveEnvironment()$currentContext() : Operation not allowed without an active reactive context. (You tried to do something that can only be done from inside a reactive expression or observer.)
.. because this is obviously the wrong approach. Without server.R line output$json <- ... result works, and looks like this , so the rest of the code is fine. But I also want to get json (or any alternative format) after some time and call the subsequent javascript action to read it as an array object. Grateful for any pointers and apologized in advance if my description is unclear.
r shiny
geotheory
source share