title: Hiding NA's when printing a dataframe in knitr
body: <p>I'm trying to print a table in knitr from a data frame using xtable . The table in the example below has the dimensions 3x7 but the third row only has one value, in the second column. The rest of the cells in the third row are 'NA'. </p>
  
  <p>When I compile the document, is there a way to prevent knitr from printing the NA's in the third row, so instead of NA I just have blank space? </p>
  
  <p>It feels like this should be a simple solution but I can't work out where/how to hide the NA's. Is it a change I need to make to the data frame or is it an xtable or knitr option I need to change?  </p>
  
  <p>Sample knitr code: </p>
  
  <pre><code>\documentclass{article}
  
  &lt;&lt; data1, echo=FALSE,  warning=FALSE, message=FALSE &gt;&gt;=
  
  require(xtable)
  
    FY.2014 &lt;- 0.019
    FY.2015 &lt;- ((7000)  - (6925.9)) / (6925.9)
    FY.2016 &lt;- ((8000)  - (7000))   / (7000)
    FY.2017 &lt;- ((9000)  - (8000))   / (8000)
    FY.2018 &lt;- ((10000) - (9000))   / (9000)
    FY.2019 &lt;- ((11000) - (10000))  / (10000)
  
    PC      &lt;- data.frame(FY.2014, FY.2015, FY.2016, FY.2017, FY.2018, FY.2019)
    PC.1    &lt;- paste(round(PC*100, digits=1), "%", sep="")
  
  
   FY.2014 &lt;- 130.1
   FY.2015 &lt;- 7000  - 6925.9
   FY.2016 &lt;- 8000  - 7000
   FY.2017 &lt;- 9000  - 8000
   FY.2018 &lt;- 10000 - 9000
   FY.2019 &lt;- 11000 - 10000
  
   AB      &lt;- data.frame(FY.2014, FY.2015, FY.2016, FY.2017, FY.2018, FY.2019)
   AB.1    &lt;- paste(round(AB , digits = 2))
  
  
      FY.2014 &lt;- as.numeric(c(""))
      FY.2015 &lt;- 7242.9
      FY.2016 &lt;- as.numeric(c(""))
      FY.2017 &lt;- as.numeric(c(""))
      FY.2018 &lt;- as.numeric(c(""))
      FY.2019 &lt;- as.numeric(c(""))
  
      PF      &lt;- data.frame(FY.2014, FY.2015, FY.2016, FY.2017, FY.2018, FY.2019)
      PF.1    &lt;- paste(round(PF , digits = 2))
  
       FTable  &lt;- rbind( PC.1, AB.1, PF.1)
  
        rownames(FTable) &lt;- c( 'Percent Change from the Previous Year', 
                               'Absolute Change from Previous Year', 
                               'December CY13 Forecast')
        colnames(FTable) &lt;- c( 'FY 2014', 'FY 2015', 'FY 2016', 'FY 2017', 'FY 2018',    'FY 2019')
  
  @ 
  
  \begin{document}
  &lt;&lt;Table 1 , echo=FALSE, eval=TRUE, results='asis', fig.width = 5, fig.height = 2,     message=FALSE, fig.align='center', warning=FALSE&gt;&gt;=
  
            xFTable  &lt;- xtable(FTable, big.mark=",")
  
            print(xFTable) 
  @
  \end{document}
  </code></pre>