Как получить файл данных из загруженного файла в блестящем - PullRequest
0 голосов
/ 16 мая 2019

Я загрузил файл в блестящее приложение для прогнозирования и смог прогноз с использованием модели Arima и не в состоянии распечатать точку прогноза в блестящем приложении.

ui.R

library(shiny) shinyUI(fluidPage(   titlePanel("DDDDDD"),  
sidebarLayout(
    sidebarPanel(    fileInput('TextFile', 'Choose Text file to upload',
                accept = c(
                  'text/csv',
                  'text/comma-separated-values',
                  'text/tab-separated-values',
                  'text/plain'
                )
      ),
      tags$hr(),
      h5(helpText("Select the read.table parameters below")),
      checkboxInput(inputId = 'header', label = 'Header', value = TRUE),
      checkboxInput(inputId = "stringAsFactors", "stringAsFactors", FALSE),
      tags$hr(),
      br(),
      selectInput("sep", "Seperator", choices = c(Comma=',',Semicolon=';',Tab='\t', Space=''), selected = ','),
      #radioButtons('skipper', 'Lines to skip',
      # c(Zero=0,
      #  One=1
      # ))
      tags$hr(),
      numericInput('year','Enter Starting Year',value =2018 ),
      tags$hr(),
      numericInput('month','Enter Starting month',value=01),
      tags$hr(),
      numericInput('frequency','Enter Frequency',value=12),

      downloadButton(outputId="downloadData",label = "DownloadData")  
    ),


    mainPanel(
      tabsetPanel(type="tab", 
                  #tabPanel("Input File Object DF ", tableOutput("filedf"), tableOutput("filedf2")),
                 # tabPanel("Input File Object Structure",verbatimTextOutput("fileob")),
                  tabPanel("ARIMA",plotOutput("contents1"), plotOutput("contents2")),
                 tabPanel("Summary", textOutput("sum")),
                tabPanel("Table",dataTableOutput("mytable1"))          

      ),

      tags$style(type="text/css",
                 ".shiny-output-error { visibility: hidden; }",
                 ".shiny-output-error:before { visibility: hidden; }"
      )



      #splitLayout(cellWidths = c("50%", "50%"), 

    )) ) )

#server.R library(shiny) library(forecast) library(DT) shinyServer(function(input, output) {
    #ARIMA Data   data_l<-reactive({
    inFile <- input$TextFile
    if (is.null(inFile))
      return(NULL)
    data<-ts(scan(inFile$datapath,skip=input$skipper),start=c(input$year,input$month),
             frequency = input$frequency)
    return(data)   })

     # Formulation for finding ARIIMA plot   output$contents1 <- renderPlot({
    data<-data_l()
    M2=auto.arima(data)
    M2F=forecast(M2,h=12)
    plot(M2F,main="ARIMA Forecast")
       })   output$contents2 <- renderPlot({
    data<-data_l()
    tsdisplay(diff(data,lag=1,differences = 1),lag.max=12,main="Is Data Stationary?")  })
     output$mytable1 <- DT::renderDataTable({
    DT::datatable(data[, input$show_vars, drop = FALSE])   })    })`enter code here`

Я хочу, чтобы точка прогноза была напечатана в другой вкладке и хотите получить необработанные данные на вкладке набора данных.

...