Hi,
I am interested in invoking a Shiny app through a JavaScript file, or, URL.
For example, I have an app where the user inputs x and the app computes x^2. The ui.R and server.R files are below:
library(shiny)
shinyUI(fluidPage(
titlePanel("Shiny Text"),
sidebarLayout(
sidebarPanel(
numericInput("x", "Value of x", 10)
),
mainPanel(
verbatimTextOutput("summary")
)
)
))
library(shiny)
shinyServer(function(input, output) {
output$summary <- renderPrint({
input$x^2
})
})
Instead of using the Shiny UI, I would like to generate a URL of the generic form:
http://host.foo.com?x=5which will produce the answer "25".
Is there a way to do this? What should the JavaScript file include?
I've been looking at the shiny.js file in the Firefox debugger, trying to understand (without success) how Shiny sends the request and receives a response. I've also looked at sites that describe how JavaScript can be embedded in Shiny, such as
http://shiny.rstudio.com/articles/dynamic-ui.htmlhttp://ryouready.wordpress.com/2013/11/20/sending-data-from-client-to-server-and-back-using-shiny/http://shiny.rstudio.com/articles/building-inputs.htmlbut these sources (if I understand correctly) always require that the app is run from R (using "runApp()").
I am a newbie in Shiny and web programming and any help is much appreciated.
Thanks!