Skip to content

Instantly share code, notes, and snippets.

@seanpue
Created May 26, 2015 20:17
Show Gist options
  • Save seanpue/52c85839439052cc07e4 to your computer and use it in GitHub Desktop.
Save seanpue/52c85839439052cc07e4 to your computer and use it in GitHub Desktop.
.Rmd to PDF
#From http://stackoverflow.com/questions/11025123/how-to-convert-r-markdown-to-pdf
rmd2pdf.bash:
RMDFILE=`echo ${1%%.*}`
echo "PROCESSING $RMDFILE"
Rscript -e "require(knitr); require(markdown); knit('$RMDFILE.rmd', '$RMDFILE.md'); markdownToHTML('$RMDFILE.md', '$RMDFILE.html', options=c('use_xhml'))"
pandoc -s "$RMDFILE.html" -o "$RMDFILE.pdf"
for f in *Rmd;do ./rmd2pdf.bash $f;done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment