rmd2html {stationery} | R Documentation |
Convert an Rmd file into an HTML file
Description
This is a very simple wrapper around the rmarkdown::render function. It makes sure that the style sheet we want to use is applied to the data.
Usage
rmd2html(
fn = NULL,
wd = NULL,
...,
verbose = FALSE,
purl = TRUE,
tangle = purl,
backup = TRUE
)
Arguments
fn |
One or more filenames ending in "*.Rmd". |
wd |
A working directory name of the Rmd file. If not specified, then the current working directory from R will be used. |
... |
Arguments that will be passed to |
verbose |
The opposite of render(quiet = TRUE). Shows compile commentary and pandoc command. Can be informative! |
purl |
Default TRUE, synonym for tangle. Set either one, or set both same, result is same. |
tangle |
Default TRUE, synonym for purl |
backup |
Default TRUE. Will create backup copies of pdf, R, Rnw
files before replacing them. Uses |
Details
Running this will be the same as running the rmd2html.sh script within the directory.
Value
A vector of output file names
Author(s)
Paul Johnson <pauljohn@ku.edu>
Examples
tdir <- tempdir()
doctype <- "rmd2html-guide"
dirout <- initWriteup(doctype, dir = file.path(tdir, doctype))
list.files(dirout)
result <- try(rmd2html("skeleton.Rmd", wd = dirout))
if(inherits(result, "try-error")){
MESSG <- paste("Compiling the markdown file failed, perhaps",
"your version of pandoc is not found")
print(MESSG)
} else {
## Check the result file:
MESSG <- paste("Check the directory", dirout, "for results.")
print(MESSG)
list.files(dirout)
if(interactive() && file.exists(file.path(dirout, "skeleton.html"))) {
browseURL(file.path(dirout, "skeleton.html"))
}
}
unlink(dirout)