title: Knitr::kable() Working in certain parts of RMD but not in others
body: <p>I am using Rmarkdown and want to display tables using knitr::kable().</p>
  
  <p>I have two chunks of code which should output a table. The thing is one works and one does not. Both are trying to output a dataframe.</p>
  
  <p>This one works:</p>
  
  <pre><code>### Payment method comparison
  How much invoice and account purchases grew for the switching merchants.
  
  ```{r, include = TRUE, echo = FALSE}
  leg_growth &lt;- skco.growth(groups = c('Purchase_Country', 'Paymethod'), unit = 'Volume') %&gt;%
    select(Purchase_Country, Paymethod, relative_growth) %&gt;%
    filter(!is.na(relative_growth),
           Paymethod != 'Credit card') %&gt;%
    mutate(relative_growth = to.percent(relative_growth - 1)) 
  
  leg_growth%&gt;%knitr::kable()
  
  ```
  </code></pre>
  
  <p>This one does not:</p>
  
  <pre><code>###Number of Brands
  This is a similar scatter plot to the previous one but shows merchants grouped by the Industry Segment.
  Number of switching merchants included in the sample.
  
  ```{r, include = TRUE, echo = FALSE}
  a&lt;-switching_data %&gt;%
    group_by(Purchase_Country) %&gt;%
    summarize(nr_brands = n_distinct(Brand_id))
  
  a%&gt;%knitr::kable()
  ```
  </code></pre>
  
  <p>I am not sure what is the difference between the two but running the code in the Rmarkdown it does not show me anything.</p>
  
  <p>The structure of the data:</p>
  
  <pre><code>&gt; str(a)
  Classes ‘tbl_df’, ‘tbl’ and 'data.frame':   4 obs. of  2 variables:
   $ Purchase_Country: chr  "d" "f" "n" "s"
   $ nr       : int  24 94 140 440
  &gt; str(leg_growth)
  'data.frame':   8 obs. of  3 variables:
   $ Purchase_Country: chr  "d" "d" "f" "f" ...
   $ method       : Factor w/ 9 levels "A","C",..: 1 7 1 7 1 7 1 7
   $ growth : chr  "55%" "-3%" "18%" "91%" ...
  </code></pre>