Partial submit

2,728 views
Skip to first unread message

Jack McCush

unread,
Apr 1, 2013, 11:46:36 AM4/1/13
to shiny-...@googlegroups.com
I have an App that allows some business users to preform what if analysis. Once they have adjusted some inputs I would like to have a button that only executes part of the server.R. For example lets say they are doing some analysis of the optimal inventory at a store after adjusting the inputs the App predicts what the optimal inventory should be set at. I would like to write this value to a database. I could have a submit button that execute the whole srever.R, but every time they submit and look at a new scenario the result is written to the database. Any ideas? 

Joe Cheng

unread,
Apr 1, 2013, 12:04:22 PM4/1/13
to shiny-...@googlegroups.com
Yes, we have a solution for this. You'll need to install the shiny-incubator package.

# Install devtools package if needed
install.packages("devtools")
devtools::install_github("shiny-incubator", "rstudio")

In your ui.R, include an actionButton("save", "Save"). This will create an input whose value starts at 0, and increases by 1 each time the button is clicked.

Then in server.R, include a chunk of code like this:

observe({
  if (input$save == 0)
    return()

  isolate({
    # Read inputs and save values to database here
  })
})

The "observe" function is how you create an observer, which is described in Reactivity Overview. The "isolate" function is described in Isolation.


On Mon, Apr 1, 2013 at 8:46 AM, Jack McCush <mccus...@gmail.com> wrote:
I have an App that allows some business users to preform what if analysis. Once they have adjusted some inputs I would like to have a button that only executes part of the server.R. For example lets say they are doing some analysis of the optimal inventory at a store after adjusting the inputs the App predicts what the optimal inventory should be set at. I would like to write this value to a database. I could have a submit button that execute the whole srever.R, but every time they submit and look at a new scenario the result is written to the database. Any ideas? 

--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

a.vanh...@gmail.com

unread,
Jun 3, 2013, 10:02:57 AM6/3/13
to shiny-...@googlegroups.com
Hi,

I installed the devtools. Then i tried to execute the second line: devtools::install_github("shiny-incubator", "rstudio")
However, I get an error telling me i have a ssl certificate problem:

> devtools::install_github("shiny-incubator", "rstudio")
Installing github repo(s) shiny-incubator/master from rstudio
Error in function (type, msg, asError = TRUE)  : 
  SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

Someone a clue to solve this?

tnx.

Op maandag 1 april 2013 18:04:22 UTC+2 schreef Joe Cheng [RStudio] het volgende:

Scott Chamberlain

unread,
Jun 10, 2013, 10:37:25 AM6/10/13
to shiny-...@googlegroups.com
The actionButton function is in the latest version (v0.6.0) of Shiny. 

Scott
Reply all
Reply to author
Forward
0 new messages