title: R Shiny error: argument "x" is missing, with no default
body: <p>I'm trying to make a model for non parametric regression with Maximal Overlap Discrete Wavelet Transform (MODWT) using <a href="https://drive.google.com/open?id=1pQ2gCkhbVyaqFqo6eKrcpzU4qJUei7PA" rel="nofollow noreferrer">this data</a> taken from <a href="https://jateng.bps.go.id/dynamictable/2016/12/16/35/-metode-baru-angka-harapan-hidup-saat-lahir-jawa-tengah-menurut-kabupaten-kota-tahun-2010-2016.html" rel="nofollow noreferrer">here</a> and <a href="https://jateng.bps.go.id/dynamictable/2016/10/17/25/-metode-baru-indeks-pembangunan-manusia-jawa-tengah-menurut-kabupaten-kota-2010-2016.html" rel="nofollow noreferrer">here</a>. The packages I'm using here are <code>shiny</code>, <code>wavelets</code>, and <code>readxl</code>.
  Here is my server code:</p>
  
  <pre><code>    server &lt;- function(input, output) {
        dataset&lt;-reactive({ 
          inFile &lt;- input$filewav 
          dat &lt;- read_excel(inFile$datapath)
          df &lt;- data.frame(dat[,2], dat[,3])
          x &lt;- seq(1,nrow(df),length = nrow(df))
          y &lt;- df[,2]
          return(dat)
        })
  
        output$plot_mra &lt;- renderPlot({
          filt &lt;- switch(input$filterwav, 
             "Haar (d2)" = filter()$haar,
             "d4" = filter()$d4,
             "d6" = filter()$d6,
             "d8" = filter()$d8,
             "s4" = filter()$s4,
             "s6" = filter()$s6,
             "s8" = filter()$s8,
             "c6" = filter()$c6,
             "c12" = filter()$c12)
  
          mra.y &lt;- switch(input$reswav, 
             "1" = y.mra()@S$S1,
             "2" = y.mra()@S$S2,
             "3" = y.mra()@S$S3,
             "4" = y.mra()@S$S4,
             "5" = y.mra()@S$S5,
             "6" = y.mra()@S$S6,
             "7" = y.mra()@S$S7,
             "8" = y.mra()@S$S8,
             "9" = y.mra()@S$S9,
             "10" = y.mra()@S$S10)
  
          set.seed(2)
          y.mra &lt;- mra(y,filt,input$reswav,"periodic",TRUE,"modwt")
          if(input$reswav==0)
                  {plot(x,y, ylab = "", type = "p", col = "red")
                  mtext("Fungsi Asli", side = 3, line = 0.1)}
          else
              {plot(x,y, ylab = "", type = "p", col = "red")
                  par(new = TRUE)
                  plot(x,mra.y, ylab = "y", xlab = "x", type = "l", col = "blue")
                  mtext("Hasil Analisis Multiresolusi dengan MODWT", side = 3, line = 0.1)}
      })
      }
  </code></pre>
  
  <p>And here is my UI code:</p>
  
  <pre><code>    ui &lt;- fluidPage(
        titlePanel("Pemodelan Regresi dengan Metode Wavelet Linier"),
  
        sidebarLayout(
          sidebarPanel(
            fileInput("filewav", "Masukkan data",
                      multiple = FALSE,
                      accept = c(".xls",".xlsx")),
          selectInput("filterwav", "Pilih filter wavelet", 
                        choices = list('Daublets' = c('Haar (d2)','d4','d6','d8'), 
                          'Symmlets' = c('s4','s6','s8'), 
                          'Coiflets' = c('c6','c12'))),
          numericInput("reswav", "Masukkan nilai resolusi", 1, min = 0, max = 10, step = NA,
        width = NULL),
            helpText("Oleh: Sania Anisa Farah")),
  
          mainPanel(
          plotOutput("plot_mra"))
      ))
  </code></pre>
  
  <p>I tried to execute those codes with <code>shinyApp(ui = ui, server = server)</code> and this is what I got:</p>
  
  <pre><code>    Warning: Error in as.ts: argument "x" is missing, with no default
      Stack trace (innermost first):
          104: as.ts
          103: filter
          102: renderPlot [#12]
           92: &lt;reactive:plotObj&gt;
           81: plotObj
           80: origRenderFunc
           79: output$plot_mra
            4: &lt;Anonymous&gt;
            3: do.call
            2: print.shiny.appobj
            1: &lt;Promise&gt;
  </code></pre>
  
  <p>Yes, that output in the R console and <a href="https://i.stack.imgur.com/lnRz9.jpg" rel="nofollow noreferrer">this</a> in the program itself. Can anybody please show me where I went wrong? And how am I supposed to fix it?</p>
  
  <p>PS: please excuse my language, I'm using Bahasa Indonesia in my program above.</p>