How do I connect R Script using the Shiny app in R?
I developed R Script and now I want to connect this R Script using Shiny app. those. I am developing my GUI in Shiny but am running into problems connecting RScript and Shiny. I want to trigger RScript output using a Shiny app.
I have looked through the RStudio Shiny app development tutorials but it didn't help me get connected. Is there a way to solve this problem?
If possible, you can give me the code for "How can I call RScript on button click with a shiny app".
UPDATE:
Can you help me with something like this: I want to download a csv file using a brilliant application (GUI) and then based on a CSV file, I created an RScript that uses the plot () function and this plot is this what I want to show through the GUI of the Shiny app.
You can just use source
like a normal R script. Let's say you have an R script called myscript.R
and it has a function called calculate()
and you want to call it when the user clicks a button in Shiny.
source("myscript.R")
runApp(shinyApp(
ui = fluidPage(
actionButton("btn", "calculate")
),
server = function(input, output, session) {
observeEvent(input$btn, {
calculate()
})
}
))