I\'ve seen some cool uses of shiny with R to make web applications and wanted to try to learn how to use it myself. I am doing the tutorial right now, but when I get to the
For me, I had this issue when I forgot about using renderPrint
, which is easy to forget when you're just starting up.
For example:
shinyServer(function(input,output) {
output$outputString <- input$something
}
)
When what I really needed to do was
shinyServer(function(input,output) {
output$outputString <- renderPrint({input$something})
}
)
I know this question is a bit dated, but responding for those who might come searching when faced with the same error message.
Since you haven't included your code, let's look at why this error message happens in general.
When the error message says "Operation not allowed without an active reactive context." what it is saying is that you are accessing a "reactive" element inside the ShinyServer
function, but outside any of the reactive functions such as renderTable
or renderPlot()
etc.
shinyServer(function(input, output) {
abc <- input$some.input.option
#other reactives here
})
reactive
This will work:
shinyServer(function(input, output) {
abc <- reactive({
abc <- input$some.input.option
})
#other reactives here
})
And now, from inside the ShinyServer function, you can access that Input parameter by calling abc()
Note the parenthesis since it is a reactive function.
Hope that helps.