Skip to content

Instantly share code, notes, and snippets.

@serihiro
Created April 21, 2019 09:11
Show Gist options
  • Save serihiro/36549937ae023fc22fe4e67f268efd89 to your computer and use it in GitHub Desktop.
Save serihiro/36549937ae023fc22fe4e67f268efd89 to your computer and use it in GitHub Desktop.
1 liner to convert a Rmd file to a R file
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: rmd2r {input}"
exit 1
fi
Rscript -e "library(knitr);input = commandArgs(trailingOnly=TRUE)[1];purl(input=input)" ${1}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment