title: R Shiny: Use function default values when fields are left blank in app
body: <p>I have an R Shiny app and I'd like to have it automatically use the default values for the function that is called by Shiny when the fields are left blank in the Shiny App. I'm providing a simple example where the Shiny App is calling the function <code>printFun</code>. I want this to work so that if, for example, a user does not put in a value for <code>b</code> in the Shiny app, the function would recognize this to be interpreted as <code>2</code>, the default value. However, if you leave <code>b</code> blank, it will not pass any value to the function. </p>
  
  <p>Are there any options to deal with defaults like this in Shiny? Thanks in advance for your help.</p>
  
  <pre><code>library(shiny)
  # simple example of function
  printFun &lt;- function(a = 1, b =2, c =3, d = 4){
    printVal &lt;- paste0(
      "one = ", a, "\n",
      "two = ", b, "\n",
      "three = ", c, "\n",
      "four = ", d, "\n"
    )
    cat(printVal)
  }
  
  # ui function
  ui &lt;- fluidPage(
    textInput("a", "a value"),
    textInput("b", "b value"),
    textInput("c", "c value"),
    textInput("d", "d value"),
    actionButton("runFun", "run function")
  )
  
  # server function
  server &lt;- function(input, output){
    observeEvent(input$runFun, {
      printFun(
        a=input$a,
        b=input$b,
        c=input$c,
        d=input$d
      )
    })
  }
  shinyApp(ui = ui, server = server)
  
  </code></pre>