R ETS模型使用闪亮

R ETS模型使用闪亮,r,shiny,ets,R,Shiny,Ets,我正在尝试创建一个具有新RStudio功能的web应用程序。 我正在尝试ETS状态空间模型。我想手动指定模型类型(server.R中的粗体文本)。我在server.R中用引号提供输入。如果我们在报价中给出IPUT,则不需要。 你能帮我 ui.R library(shiny) shinyUI(pageWithSidebar( headerPanel( "Forecast", "Flowserve"), sidebarPanel( fileInput('file1', 'Select

我正在尝试创建一个具有新RStudio功能的web应用程序。 我正在尝试ETS状态空间模型。我想手动指定模型类型(server.R中的粗体文本)。我在server.R中用引号提供输入。如果我们在报价中给出IPUT,则不需要。 你能帮我

ui.R

library(shiny)
shinyUI(pageWithSidebar(
  headerPanel( "Forecast", "Flowserve"),
  sidebarPanel(
    fileInput('file1', 'Select csv file',
              accept=c('text/csv')
              ),
    checkboxInput('header', 'Header', TRUE),
    radioButtons('sep', 'Separator',
                 c(Comma=',', Semicolon=';', Tab='\t')
                 ),
    tags$hr(),
    numericInput("startyear", "Start Year and Month",2010),
    sliderInput("month","",min=1, max=12,value=1, step=1, animate=T),

    tags$hr(),
    selectInput("error", "Error Type", list("Multiplicative"="M","Additive"="A")),
    selectInput("trend", "Trend Type", list("Multiplicative"="M","Additive"="A", "Null"="N")),
    selectInput("seasonal", "Seasonal Type", list("Multiplicative"="M","Additive"="A", "Null"="N")),
  submitButton("UPDATE")
  ),

  mainPanel(

    tabsetPanel(
    tabPanel("Data", tableOutput('contents')),
    tabPanel("Time Plot",  plotOutput('tsplot')),
    tabPanel("Forecast",  plotOutput('plotforecast'))
            )
    )
))
library(shiny)
library(forecast)
shinyServer(function(input,output){

  data1 = reactive({
  inFile<-input$file1
  if(is.null(inFile))
    return(NULL)
  read.csv(inFile$datapath, header=input$header, sep=input$sep)
  })
output$plotforecast<-renderPlot(function(){
  datats<-ts(data1(), start=c(input$startyear,input$month), frequency=12)
  model<-ets(datats, model="input$error input$trend input$seasonal")
  fit1<-fitted(model)
  future1<-forecast(model, h=4, level=c(95,97.5))  
  p2<-plot.forecast(future1,shadecols=c("yellow","orange"), xlab=expression(bold(Year)), ylab=expression(bold(Demand)))
  print(p2)
  })
server.R

library(shiny)
shinyUI(pageWithSidebar(
  headerPanel( "Forecast", "Flowserve"),
  sidebarPanel(
    fileInput('file1', 'Select csv file',
              accept=c('text/csv')
              ),
    checkboxInput('header', 'Header', TRUE),
    radioButtons('sep', 'Separator',
                 c(Comma=',', Semicolon=';', Tab='\t')
                 ),
    tags$hr(),
    numericInput("startyear", "Start Year and Month",2010),
    sliderInput("month","",min=1, max=12,value=1, step=1, animate=T),

    tags$hr(),
    selectInput("error", "Error Type", list("Multiplicative"="M","Additive"="A")),
    selectInput("trend", "Trend Type", list("Multiplicative"="M","Additive"="A", "Null"="N")),
    selectInput("seasonal", "Seasonal Type", list("Multiplicative"="M","Additive"="A", "Null"="N")),
  submitButton("UPDATE")
  ),

  mainPanel(

    tabsetPanel(
    tabPanel("Data", tableOutput('contents')),
    tabPanel("Time Plot",  plotOutput('tsplot')),
    tabPanel("Forecast",  plotOutput('plotforecast'))
            )
    )
))
library(shiny)
library(forecast)
shinyServer(function(input,output){

  data1 = reactive({
  inFile<-input$file1
  if(is.null(inFile))
    return(NULL)
  read.csv(inFile$datapath, header=input$header, sep=input$sep)
  })
output$plotforecast<-renderPlot(function(){
  datats<-ts(data1(), start=c(input$startyear,input$month), frequency=12)
  model<-ets(datats, model="input$error input$trend input$seasonal")
  fit1<-fitted(model)
  future1<-forecast(model, h=4, level=c(95,97.5))  
  p2<-plot.forecast(future1,shadecols=c("yellow","orange"), xlab=expression(bold(Year)), ylab=expression(bold(Demand)))
  print(p2)
  })
库(闪亮)
图书馆(预测)
shinyServer(功能(输入、输出){
数据1=无功({

infle您应该替换
模型尝试替换
模型非常感谢Sgibb…它正在工作…您能告诉我“粘贴0”的含义吗?请注意,不需要显式换行符(

),我删除了它们。