Note that there are some explanatory texts on larger screens.

plurals
  1. POETS model using Shiny
    text
    copied!<p>Im trying to create a web application with the new RStudio feature <em>Shiny</em>. I'm trying ETS state space model. I want to specify model type manually (<em>Bold text in server.R</em>). I'm giving inputs within quotes in server.R. If we give iputs within quotes it will not take. Could you please help me...</p> <p><strong>ui.R</strong></p> <pre><code>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')) ) ) )) </code></pre> <p><strong>server.R</strong></p> <pre><code>library(shiny) library(forecast) shinyServer(function(input,output){ data1 = reactive({ inFile&lt;-input$file1 if(is.null(inFile)) return(NULL) read.csv(inFile$datapath, header=input$header, sep=input$sep) }) output$plotforecast&lt;-renderPlot(function(){ datats&lt;-ts(data1(), start=c(input$startyear,input$month), frequency=12) model&lt;-ets(datats, model="input$error input$trend input$seasonal") fit1&lt;-fitted(model) future1&lt;-forecast(model, h=4, level=c(95,97.5)) p2&lt;-plot.forecast(future1,shadecols=c("yellow","orange"), xlab=expression(bold(Year)), ylab=expression(bold(Demand))) print(p2) }) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload