title: Run R script after input in Shiny
body: <p>Good morning everyone, </p>
  
  <p>I have a Shiny application that collects 5 inputs from the users and stores them into variables. </p>
  
  <p>Then, I would be able to use another R script that would run based on the information provided by the user.</p>
  
  <p>Here is a sample of my Shiny App : </p>
  
  <pre><code>jscode &lt;- "shinyjs.closeWindow = function() { window.close(); }"
  
  #Define UI for application
  
  ui &lt;- pageWithSidebar(
    #App title
    headerPanel("Filters applied for Powerpoints"),
  
     #Panel to display the filters
    sidebarPanel(
      #Select dates
      dateInput(inputId = "startDate", label = "Start date : ", value = "2018-12-01", format = "yyyy/mm/dd"),
      dateInput(inputId = "endDate", label = "End date : ", value = "2018-12-31", format = "yyyy/mm/dd"),
  
      #Select brand template
      selectInput("Brand", label = "Select brand : ", choices = list("Carat" = "Carat", "Amplifi" = "Amplifi", "iProspect" = "iProspect", "Isobar" = "Isobar")),
  
      #Select medium type
      selectInput("Medium", label = "Select medium type : ", choices = list("Social Post" = "Social Post", "Display" = "Display", "Programmatic" = "Programmatic", "SEA" = "SEA")),
  
      #Enter the plan ID of your campaign
      textInput("Camp", label = "Enter the plan ID of your campaign : ", value = ""),
  
      #Button to close the window, then run script
      useShinyjs(),
      extendShinyjs(text = jscode, functions = c("closeWindow")),
      actionButton("close", "Close and run")
    ),
    mainPanel()
  )
  
  #Define server logic
  server &lt;- function(input, output, session){
    observe({
      startDate &lt;&lt;- input$startDate
      endDate &lt;&lt;- input$endDate
      brand &lt;&lt;- input$Brand
      medium &lt;&lt;- input$Medium
      campaign &lt;&lt;- input$Camp
    })
    observeEvent(input$close, {
      js$closeWindow()
      stopApp()
    })
    source("C:/Users/RPeete01/Desktop/Automated powerpoints/Datorama R/Datorama reporting R/DatoramaSocial.R")
  }
  
  
  #Run the application 
  shinyApp(ui = ui, server = server)
  </code></pre>
  
  <p>I've used the source function but it doesn't work.</p>
  
  <p>If someone has an idea, please let me know. </p>
  
  <p>Thanks a lot, </p>
  
  <p>Rémi</p>