[R] intermediate action button necessary to update graph-not responding
Clarkson, Christopher
christopher.clarkson15 at imperial.ac.uk
Tue May 10 15:23:27 CEST 2016
Hello,
I'm aware that this is not a suitable question for this resource but neither Stackoverflow nor shiny help forum could help with the problem I'm having- is it possible that you could point me in the right direction?
thanks
Chris
I have a command from a particular package that outputs a graph. The command requires preliminary processed input via a different command that is defined in the same package. Hence my plan is to create an app whereby the user can interactively update the map. This as far as I can see will require 2 action buttons: "actionbutton A" will re-run the preliminary processing command with input from a "checkboxGroupInput". "actionbutton B" will then update the graph with the new input from the preliminary processing command.
#ui.R
checkboxGroupInput("column_choices", "column choice", colnames(data), selected=c("column1", "column2"....)),
actionButton(inputId="choices", label="Update tag"))
actionButton(inputId="replot", label="Update plot")),
plotOutput("graph")
#server.R
servercell <- function(input, output) {
dataInput<-observeEvent(input$choices, {
isolate(tagData(IRIS[, input$column_choices]))
})
output$SPV<-renderPlot({
input$replot
isolate(package_defined_plot_function(data=data, dataTag=dataInput()))
})
}
The buttons work when tested independent of each other: the checkbox input seems to update fine, after clicking "Update tag"/actionbutton A and the graph seems to work fine after clicking "Update plot"/actionbutton B (when dataInput() is not an argument in the plot function).
My problem is that dataInput<-observeEvent(input$choices, {..... does not allow the graph to display. When dataInput() is made an argument of the plotting function- instead of the graph displaying on the app page- in place of that I get the error: could not find dataInput function
As I said buttons A and B work fine when independent of each other..... however their coexistence conflicts... and having two action buttons is the only way I can think of to update the graph interactively... if anyone can think of how to do it with one button that would be great.
When I do this with one output command, :
output$SPV<-renderPlot({
dataInput<-
package_defined_plot_function(data=data, dataTag=tagData(runif(input$cell_choices(isolate())))
})
I try some variation(cannot remember the actual syntax) of the above but it forces me to shut down my R session as the data handling seems to go on an infinite loop (I can not show you the exact error for this as in order to get it I have to crash the R session- it looks some thing like: "cannot compute -Inf"). hence I would be much more comfortable with tow buttons.
I am quite stuck as I don't know what to do... any tips?
[[alternative HTML version deleted]]
More information about the R-help
mailing list