title: Why does datatable not print when looping in rmarkdown?
body: <p>I am working on creating a dynamic rmarkdown document.  The end result should create a tab for each 'classification' in the data.  Each tab should have a datatable, from the DT package, with the data printed to it.  Below is the code I have been using:</p>
  
  <pre><code>---
  output: html_document
  ---
  
  # Setup{.tabset}
  ```{r setup, include=FALSE}
  knitr::opts_chunk$set(echo = FALSE)
  library(knitr)
  library(DT)
  ```
  
  ```{r data.setup}
  set.seed = 1242
  rows = 64
  data.1 = runif(rows, 25, 75)
  data.2 = runif(rows, .01, 1)
  data.3 = runif(rows, 1, 10)
  classification = c("A", "B", "C", "D")
  df = data.frame(cbind(data.1 = data.1, data.2 = data.2, data.3 = data.3, classification = classification))
  df$data.1 = as.numeric(df$data.1)
  df$data.2 = as.numeric(df$data.2)
  df$data.3 = as.numeric(df$data.3)
  ```
  
  ```{r results= 'asis'}
  for(j in levels(df$classification)){
          df.j = df[df$classification == j, ]
          cat(paste("\n\n## Classification: ", j, "##\n"))
          w = datatable(df.j)
          #datatable(df.j)
          print(w)
  }
  ```
  </code></pre>
  
  <p>Notice I have commented out straight calls to the datatable function, those were not printing to rmarkdown.  The results of the call as written generate an html document with the correct tabs, but no datatables in them.  Additionally, the datatables actually display in my RStudio session with the correct subsetting.  As a test, I tried achieving the goal using the kable function from knitr, and the tables were printed in their appropriate tabs, unfortunately, kable does not have all the functionality required.</p>