title: Shiny app, only showing some graphs
body: <p>I am using shiny app to make some forecast graphs. However, I have a problem that the app only shows some graphs. I am currently using the following code for the server part of the app.</p>
  
  <pre><code>server &lt;- function(input, output) {  
  
   output$graph &lt;- renderPlot({
        row.number &lt;- which(grepl(input$n1, Data$Kontotal))
        name &lt;- Data [row.number, -(1:3)]
        name &lt;- t(name)
        name &lt;- ts(name, frequency=12, start=c(2007,1))
        n.row &lt;- nrow(name)
  
        en&lt;-max(time(name))
        ds&lt;-as.data.frame(window(name,end=en))
        names(ds)&lt;-'obs'
        ds$date&lt;-as.Date(time(window(name,end=en)))     
  
  
         p1a &lt;- ggplot(data=ds,aes(x=date,y=obs)) 
         p1a &lt;- p1a+geom_line(col='red')
         p1a &lt;- p1a+scale_x_date(name='',breaks='1 year',minor_breaks='1 month',labels=date_format("%b-%y"),expand=c(0,0))
         p1a &lt;- p1a+scale_y_continuous(name='mio.kr')
         p1a &lt;- p1a + theme_bw() + 
              theme(panel.border = element_blank(), 
                    panel.grid.major = element_blank(),
                    panel.grid.minor = element_blank(), 
                    axis.line = element_line(colour = "black")) })
  
  
   output$graph2 &lt;- renderPlot({
  
    if (input$n3 == "HW") { 
             row.number &lt;- which(grepl(input$n1, Data$Kontotal))
             name &lt;- Data [row.number, -(1:3)]
             name &lt;- t(name)
             name &lt;- ts(name, frequency=12, start=c(2007,1))
             n.row &lt;- nrow(name)
  
  
             fit &lt;- auto.arima (name)
             fcast &lt;- forecast(fit, input$n2)
  
  
  
             ### Plotting
  
             data.pred &lt;- forc.ggplot (name, fcast)
  
  
  
  
             p1a &lt;- ggplot(data=data.pred,aes(x=date,y=obs)) 
             p1a &lt;- p1a+geom_line(col='red')
             p1a &lt;- p1a+geom_line(aes(y=fitted),col='blue')
             p1a &lt;- p1a+geom_line(aes(y=forecast))+geom_ribbon(aes(ymin=lo95,ymax=hi95),alpha=.25)
             p1a &lt;- p1a+scale_x_date(name='',breaks='1 year',minor_breaks='1 month',labels=date_format("%b-%y"),expand=c(0,0))
             p1a &lt;- p1a+scale_y_continuous(name='mio.kr')
             p1a &lt;- p1a + theme_bw() + 
                  theme(panel.border = element_blank(), 
                        panel.grid.major = element_blank(),
                        panel.grid.minor = element_blank(), 
                        axis.line = element_line(colour = "black"))
             p1a
  
  
        }  
  
    if (input$n3 == "arima") { 
          row.number &lt;- which(grepl(input$n1, Data$Kontotal))
          name &lt;- Data [row.number, -(1:3)]
          name &lt;- t(name)
          name &lt;- ts(name, frequency=12, start=c(2007,1))
          n.row &lt;- nrow(name)
  
  
          fit &lt;- auto.arima (name)
          fcast &lt;- forecast(fit, input$n2)
  
  
  
          ### Plotting
  
          data.pred &lt;- forc.ggplot (name, fcast)
  
  
  
  
          p1a &lt;- ggplot(data=data.pred,aes(x=date,y=obs)) 
          p1a &lt;- p1a+geom_line(col='red')
          p1a &lt;- p1a+geom_line(aes(y=fitted),col='blue')
          p1a &lt;- p1a+geom_line(aes(y=forecast))+geom_ribbon(aes(ymin=lo95,ymax=hi95),alpha=.25)
          p1a &lt;- p1a+scale_x_date(name='',breaks='1 year',minor_breaks='1 month',labels=date_format("%b-%y"),expand=c(0,0))
          p1a &lt;- p1a+scale_y_continuous(name='mio.kr')
          p1a &lt;- p1a + theme_bw() + 
               theme(panel.border = element_blank(), 
                     panel.grid.major = element_blank(),
                     panel.grid.minor = element_blank(), 
                     axis.line = element_line(colour = "black"))
          p1a
  
  
     }  
  
  
   })
  </code></pre>
  
  <p>}</p>
  
  <p>The problem is that only the ARIMA graph is showing. <strong>Note</strong>, however, that in the code posted here I changed the model in the HW-part of the code, so it is identical with the ARIMA part (including the model), just to check that it was because something was wrong with the ets function (which I used to estimate the HW model).</p>
  
  <p>It simply leaves a blank space where the graph should have been in the case of HW, but plots the right graph for the ARIMA model.</p>
  
  <p>Anyone tried anything similar? </p>