knit2docx: knit2docx

Description Usage Arguments Examples

Description

knit2docx

Converts Rmd to docx including some sideeffects, such as figure labelling, file renaming etc. Currently settings are rather tightly tied to the requirements of pelagic publishing. Also it is not tested on anything else than linux. Pandoc and pandoc-citeproc must be installed and in your path. It is not overly beautiful, could be more efficient and less of a hack, but does the job.

Usage

1
2
knit2docx(.fileBasename, .docxFile = NULL, .withBibliography = TRUE,
  .bibFile = NULL, .bibStyle = "harvard1_mod.csl")

Arguments

.fileBasename

character. basename of .Rmd file without extension, e.g. "Chapter1". Should be preceded by a path if not in the current working directory, e.g. "FolderX/Chapter1".

.docxFile

optional. character. basename of output docx file. If not suplied .fileBasename will be used.

.withBibliography

logical. run pandoc with or without pandoc-citeproc, i.e. with or without resolving citatations to a bibliography

.bibFile

character. basename of Bibtex .bib file. Optional if equal to x.

.bibStyle

literature formatting style

stopOnErrors

logical. Stop if there were errors in R code. (Happens after knitr)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
## Copy demo files to knit2docx_demo folder
dir.create("knit2docx_demo")
file.copy(list.files(system.file("extdata/demo/", package = "knit2docx")), "knit2docx_demo", recursive = TRUE)
rlist.files("knit2docx_demo")
## Convert Rmd to docx
knit2docx("knit2docx_demo/Chapter_template")
## Open with Word:
list.files("knit2docx_demo", pattern = "docx")
## Remove demo directory
unlink("knit2docx_demo", recursive = TRUE)

## End(Not run)

bleutner/knit2docx documentation built on May 12, 2019, 9:31 p.m.