title: Render Rmarkdown to directory outside R package
body: <p>I have a R package that generates a RMarkdown html report. The .Rmd file lives in the system library/package directory.
  I would like to create a function <code>htmlreport()</code> to save the html report to the specified output directory path.
  In case <code>output_path</code> is not specified the function should give the possibility to browse to the output folder.</p>
  <p>After rendering I would also like to open the resulting html report.</p>
  <p>I am no sure how to do this. It seems that the path to the output file is always relative to the .Rmd file.  How can I achieve this?</p>
  <pre><code>htmlreport &lt;- function(output_path = NULL){
   f &lt;- system.file(&quot;inst/rmd&quot;, &quot;html_report.Rmd&quot;, package = &quot;abc&quot;)
  
   if (is.null(outputh_path)) { 
      output_path &lt;- ?? &quot;Choose output folder&quot; ....??
   }
  
   rmarkdown::render(f, output_dir = output_path) 
  
   # and open the html report..?
  }
  </code></pre>