1 #Run script with $Rscript createDoc.R input.Rmd output.html
3 require(knitr) # required for knitting from rmd to md
4 require(markdown) # required for md to html
6 args <- commandArgs(TRUE)
9 stop("Please provide 2 arguments corresponding to input and output file!")
11 inputFile <- args[[1]] # .Rmd file
12 outputFile <- args[[2]] # .html file
14 # Create and fill temp .md file from existing .Rmd file
15 #tempMdFile <- tempfile("tempREADME", fileext = "md")
16 knitr::knit(inputFile, outputFile)
17 #knitr::knit(inputFile, tempMdFile)
19 # Generate HTML from temporary .md file
20 #markdown::markdownToHTML(tempMdFile, outputFile)