title: Several ggplotly figures from within if block in rmarkdown
body: <p>I am unable to generate an html file, from rmarkdown, which displays two or more ggplotly plots created inside an if block in a given code chunk.</p>
  
  <p>My MWE rmarkdown source code follows:</p>
  
  <pre><code>---
  title: Several ggplotly figures from within if block in rmarkdown
  author: "Mauricio Calvao"
  date: "February 27, 2017"
  output:
      html_document: default
  ---
  
  ```{r setup, include=FALSE}
  knitr::opts_chunk$set(echo = TRUE)
  ```
  
  ```{r}
  library(ggplot2)
  library(plotly)
  ```
  
  
  ## Outside if block:
  
  I can have rmarkdown generate an html document with two ggplotly plots, outside of an if block in a given chunk:
  
  ```{r}
  ggplotly(qplot(data = pressure, x = temperature, y = pressure))
  ggplotly(qplot(data = pressure, x = pressure, y = temperature))
  ```
  
  ## Inside if block:
  
  However, when I try the same code inside an if block, only the last plot shows up in the html document:
  
  ```{r}
  if (TRUE) {
  ggplotly(qplot(data = pressure, x = temperature, y = pressure))
  ggplotly(qplot(data = pressure, x = pressure, y = temperature))
  }
  ```
  
  
  
  **How do I print two (or more plots, for that matter) from within an if block in the html document???**
  
  The above is a MWE, but, in fact, in a more general setting I would have a large number of plots to be printed depending on several if else blocks...
  </code></pre>
  
  <p>Any suggestions are welcome!!</p>