title: looping with two variable for htmltools::withTags?
body: <pre><code>sketch = htmltools::withTags(table(
    class = 'display',
    thead(
      tr(
        th(rowspan = 2, 'Species'),
        th(colspan = 2, 'Sepal'),
        th(colspan = 2, 'Petal')
      ),
      tr(
        lapply(rep(c('Length', 'Width'), 2), th)
      )
    )
  ))
  print(sketch)
  </code></pre>
  
  <p>and get </p>
  
  <pre><code>&lt;table class="display"&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th rowspan="2"&gt;Species&lt;/th&gt;
        &lt;th colspan="2"&gt;Sepal&lt;/th&gt;
        &lt;th colspan="2"&gt;Petal&lt;/th&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;th&gt;Length&lt;/th&gt;
        &lt;th&gt;Width&lt;/th&gt;
        &lt;th&gt;Length&lt;/th&gt;
        &lt;th&gt;Width&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Is there a way to loop this two lines if i have N columns?</p>
  
  <pre><code>  &lt;th colspan="2"&gt;Sepal&lt;/th&gt;
    &lt;th colspan="2"&gt;Petal&lt;/th&gt;
  </code></pre>
  
  <p>something like:</p>
  
  <pre><code>lapply(c('Sepal', 'Petal'), th)
  </code></pre>
  
  <p>But I could not figure out how to put in the "<code>colspan=2</code>" part.</p>
  
  <p>Thanks a lot,</p>