title: Add r chunk within output of html_document - css files
body: <p>I would like to add css files into my Rmd using <code>r chunk</code>. For example</p>
  
  <pre><code>---
  title: "Untitled"
  output: 
      html_document:
          css: '`r system.file("shinydashboard.css" , package = "shinydashboard")`'
  ---
  </code></pre>
  
  <p>but I got error:</p>
  
  <pre><code>pandoc: Could not fetch `r system.file(
  `r system.file(: openBinaryFile: does not exist (No such file or directory)
  Error: pandoc document conversion failed with error 67
  Execution halted
  </code></pre>
  
  <p>I read both related questions (<a href="https://stackoverflow.com/questions/23449319/yaml-current-date-in-rmarkdown">this</a> and <a href="https://stackoverflow.com/questions/32637340/inline-r-code-in-yaml-for-rmarkdown-doesnt-run?noredirect=1&amp;lq=1">this</a>), but they did not cover situation when <code>r chunk</code> occurs in <code>html_document</code> output (Ramnathv mentioned <code>brew</code> package but I did not test it, besides it was posted in '14.). </p>
  
  <p>It would be great if it would be possible to do it, and still using <code>Knit</code> button in RStudio.</p>
  
  <p>Thanks,</p>
  
  <p><strong>Update</strong></p>
  
  <p>Another thing is when I want to include all .css files from one directory using <code>r chunk</code> within <code>html_document</code>. Here I want to include all files from <code>www</code> directory:</p>
  
  <pre><code>---
  title: "Untitled"
  output: 
      html_document:
          css: "`r x &lt;- list.files(path = 'www', pattern = '*.css', full.names = T); x &lt;- paste(x, collapse = '\', \'');z &lt;- paste0('[ \'', paste0(x, collapse = ', '), '\' ]'); z`"
  ---
  </code></pre>