Description Usage Arguments Details Value Author(s) Examples
Convert an Rmd file to PDF by Sweaveing or knitting and then compiling.
1 2 3 4 5 6 7 8 9 |
fn |
One or more filenames ending in "*.Rmd". |
wd |
A working directory in which the Rmd file exists. Leave as NULL if file is in current working directory, |
... |
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 |
tangle |
Default TRUE, synonym for purl |
backup |
Default TRUE. Will create backup copies of pdf, R, Rnw
files before replacing them. Uses |
Running this will be the same as running the rmd2pdf.sh script within the directory.
A vector of output file names
Paul Johnson <pauljohn@ku.edu>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | tdir <- tempdir()
fmt <- "rmd2pdf-guide"
dirout <- initWriteup(fmt, dir = file.path(tdir, fmt))
print(dirout)
list.files(dirout)
of1 <- try(rmd2pdf("skeleton.Rmd", wd = dirout))
if(inherits(of1, "try-error")){
MESSG <- paste("Compiling the markdown file failed, perhaps",
"you should run with parameters verbose=TRUE",
"and keep_tex=TRUE")
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.pdf"))) {
browseURL(of1)
}
}
unlink(dirout)
|
[1] "/work/tmp/tmp/RtmpknXU1X/rmd2pdf-guide"
[1] "instructions.Rmd" "R.bib" "rmd2pdf.R" "rmd2pdf.sh"
[5] "skeleton.Rmd" "theme"
processing file: skeleton.Rmd
|
| | 0%
|
|...... | 9%
|
|............. | 18%
|
|................... | 27%
|
|......................... | 36%
|
|................................ | 45%
|
|...................................... | 55%
|
|............................................. | 64%
|
|................................................... | 73%
|
|......................................................... | 82%
|
|................................................................ | 91%
|
|......................................................................| 100%
output file: skeleton.R
Error : pandoc version 1.12.3 or higher is required and was not found (see the help page ?rmarkdown::pandoc_available).
[1] "Compiling the markdown file failed, perhaps you should run with parameters verbose=TRUE and keep_tex=TRUE"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.