-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I refresh the data import in shiny automatically ? #828
Comments
The usual way to do this is to add an output$plot <- renderPlot({
input$go_button # This makes the renderPlot depend on the go_button
p1 <- ggplot(summaryseattle, aes(x = Category, y = Sum, fill = Category)) +
geom_bar(stat= "identity") + ylab("Total Amount (dollars)") +
geom_text(aes(Category, Sum, label = Sum, vjust = -0.5)) +
coord_cartesian(ylim = c(0,10000)) + ggtitle(paste("Total amount collected so far from ticket sales is $", sum(summaryseattle$Sum)))
p1
}) See the action button article for more information. |
I'm having a similar issue, and I don't thing the reply by @wch actually solves the issue: how to refresh data import. As far as i can tell, wch's solution refreshes the plot, but not the imported data.. I have tried to fix this - so far without luck. This is my minimally not-working example, which makes use of observeEvent and reactiveValues. For the MnWE I've provided a simple google sheet (should be accessible and editable via this link: https://docs.google.com/spreadsheets/d/1s1ZMQgyesYOIjIJb31chtONaiRjhXezN3xqpKSP9_hk/edit?usp=sharing Changing the google sheet and 'reloading' in the script below does not scratch my itch :-( Server:
UI:
|
data <- eventReactive(input$reload, {
url <- "https://docs.google.com/spreadsheets/d/1s1ZMQgyesYOIjIJb31chtONaiRjhXezN3xqpKSP9_hk/edit?usp=sharing"
gsheet2tbl(url)
}, ignoreNULL = FALSE)
output$table <- renderDataTable(data()) The |
That was very helpful and I think I'm almost there ... perhaps google sheets is not the best way to go, but now it's become a matter of principle :-) The following still doesn't work for me however, which I really expected it to .. server.R
ui.R
|
@wch I hope I'm not being a pain ... but I'm completely stumped here. I've tried and tried again over the last three days. I posted at google groups and via IRC without luck. I have read the fine manual online but I simply can not see why this shouldn't work
When I run the app -- the actionButton shows up and from the console (see below) I gather the google spread sheet is loaded into memory. Clicking the button causes the textOutput('clics') to update and prints the number to the web page ... but the tableOutput('dataTbl') doesn't I have tried a number of other possible way (e.g. using RV$data <- eventReactive instead of observeEvent) |
You're using That said, I also recommend you do it the |
I did catch you reply and it was very helpful ... It's working for me now Thanks a lot for you help and excellent work with Shinyapps .. Kind regards On 23 April 2016 at 18:22:50 +02:00, Joe Cheng notifications@github.com wrote:
|
Hi, I am using googlesheets data and importing it into shiny to plot data. I want to create a button which would automatically start the whole execution of the processes. How do I do that ? The code I have is as follows:
ui.R
server.R
The text was updated successfully, but these errors were encountered: