2

I have one script which plots the graph for any category type say A,B & C ,i am using "textinput" for entering desired category. Now i want to pass this selected category to another script through URL. This script should take that value and do calculations. How can i pass variables from one shiny script to another as input?

0

1 Answer 1

1

Well, there are many different ways for sending data via URL.

This is a very primitive example of a dispatcher app, using HTTP GET via readlines() for sending some tiny data with Shiny to a remote URL.

In this answer, you can read how to parse the data from the query string when creating the receiver app.

library(shiny)

dataToBeSent <- list(
  "someVariable" = "myValue",
  "anotherVariable" = "anotherValue"
)

ui <- shinyUI(
  titlePanel("Simply sending some data via HTTP GET")
)

server <- shinyServer(function(input, output, session) {
  sendData <- function ( listData, url ){
    print("Server says: Let's pass data to a remote url!")
    url <- paste0( url,"?",paste(paste( names(listData),unname(listData),sep="=" ),collapse="&"))
    readLines(URLencode(url))
  }
  sendData( dataToBeSent, "http://www.example.com/shinyApp/"  )
})

shinyApp(ui = ui, server = server)

Depending on what you want to achieve, if you want to share large amounts of data, it might be better to use a shared database or to use an HTTP POST request instead.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.