title: how to automatically convert .Rmd file to pdf
body: <p>I would like to automate "knit PDF" functionality in RStudio i.e. conversion from .Rmd file to .pdf. I looked for answers on stackoverflow and found a lot of suggestions, but not really an answer to this specific questions. For example, some suggest using knit2pdf, but knit2pdf requires .Rnw (not .Rmd) as an input, etc. One workflow I found here <a href="http://rprogramming.net/create-html-or-pdf-files-with-r-knitr-miktex-and-pandoc" rel="nofollow">http://rprogramming.net/create-html-or-pdf-files-with-r-knitr-miktex-and-pandoc/</a> uses:
  (1) knit to convert from .Rmd to .md (2) markdownToHTML to convert
  from .md to .html and (3) pandoc to convert from .html to .pdf,
  so in principle accomplishes what I want, but result is not the same as from
  "knit PDF" in RStudio (and suboptimal).</p>