0

hereおよびhereから取得したこのデータを使用して、Maximal Overlap Discrete Wavelet Transform (MODWT) を使用してノンパラメトリック回帰のモデルを作成しようとしています。ここで使用しているパッケージは、、、およびです。ここに私のサーバーコードがあります:shinywaveletsreadxl

    server <- function(input, output) {
      dataset<-reactive({ 
        inFile <- input$filewav 
        dat <- read_excel(inFile$datapath)
        df <- data.frame(dat[,2], dat[,3])
        x <- seq(1,nrow(df),length = nrow(df))
        y <- df[,2]
        return(dat)
      })

      output$plot_mra <- renderPlot({
        filt <- 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 <- 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 <- 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)}
    })
    }

そして、ここに私のUIコードがあります:

    ui <- 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"))
    ))

私はこれらのコードを実行しようとしましたがshinyApp(ui = ui, server = server)、これは私が得たものです:

    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: <reactive:plotObj>
         81: plotObj
         80: origRenderFunc
         79: output$plot_mra
          4: <Anonymous>
          3: do.call
          2: print.shiny.appobj
          1: <Promise>

はい、その出力は R コンソールにあり、これはプログラム自体にあります。誰かが私が間違っていた場所を教えてもらえますか? そして、どのように修正すればよいですか?

PS: 私の言語を許してください、私は上記の私のプログラムで Bahasa Indonesia を使用しています。

4

0 に答える 0