2

I want to plot something with renderDataTable. Thats how I send it to the ui.R

output$myTable <- renderDataTable(myTableSelection())

Thats how the ui.R recieves it:

... tabPanel("Title", value = 4, dataTableOutput("myTable ")))), ...

Before the table is rendered, some preprocessing of the data is necessary. I keep getting this errormessage:

Error in .func() : object 'input' not found

To narrow down the error I kept commenting out lines that process the dataframe before sending it to renderDataTable. I narrowed it down to these lines:

someName <- eventReactive(input$someInputA, {
    if( (as.integer(input$someInputB) == 2) ) {
        return(someDf[someDf$someColumn %in% input$someInputA ,])

    } else {
        print("Whatever")
    }
})

Everywhere else in my code it works when I refer to a variable from the ui.R with input$whatever, but not here.

When I print the two inputs document with the code that wont execute like so

observe({
    print(input$someInputA)
    print(input$someInputB)
})

It gets printed properly.

I even tried to assign input$... to some variables in global.R but that did not help neither. Any ideas why?!

four-eyes
  • 10,740
  • 29
  • 111
  • 220
  • 1
    All render-functions expect expressions instead of values, e.g. `renderDataTable({myTableSelection()})` – Patrick Roocks Nov 26 '15 at 14:17
  • @PatrickRoocks thanks for pointing that out! But that did not fix the problem. I do not understand why I cannot access any input from my ui there... – four-eyes Nov 26 '15 at 14:25
  • The `input` variable is a parameter that's passed via `shinyServer(function(input, output) {})`. Are you sure your `input$` code is within the `shinyServer` function? The errors sound like that's not the case. You really should provide a minimal [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) so we can see exactly what you are doing. – MrFlick Nov 26 '15 at 14:56
  • @MrFlick 1. I wrote that exact code into the `server.R` function - it does not work. I have other `.R` files where I access the same `input$...`. which I source within the `server.R` function, that works fine. 2. I tried to write that peace of code in the same `.R` files where I access the same `input$..`, does not work neither... 3. Finally I sourced the `.R` file within the `server.R` function too - no success... – four-eyes Nov 26 '15 at 15:24
  • We need a reproducible example in order to see what's going on. – MrFlick Nov 26 '15 at 15:40
  • @MrFlick working on it – four-eyes Nov 26 '15 at 15:40

0 Answers0