Skip to content

Commit

Permalink
Add argument params
Browse files Browse the repository at this point in the history
  • Loading branch information
paulnorthrop committed Oct 23, 2023
1 parent 64ce2eb commit 2ad8b4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions R/rmd2word.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
#' @param inc_word A logical scalar. If \code{inc_word = TRUE} then the Word
#' files are included in the zip file created. Otherwise, they are not
#' included.
#' @param params A list of named parameters to pass to pass as the argument
#' \code{params} to \code{\link[rmarkdown]{render}}.
#' @param ... Additional arguments to be passed to
#' \code{\link[rmarkdown]{word_document}}.
#' @details Information such as \code{title}, \code{author}, \code{lang} etc in
Expand Down Expand Up @@ -166,7 +168,7 @@
rmd2word <- function(x, doc = "accessr",
pdf = isTRUE(.Platform$OS.type == "windows"), dir,
zip = TRUE, add = FALSE, quiet = TRUE, rm_word = FALSE,
rm_pdf = FALSE, inc_word = FALSE, ...) {
rm_pdf = FALSE, inc_word = FALSE, params = NULL, ...) {
# Warn that PDF files can only be produced on Windows
if (pdf && isFALSE(.Platform$OS.type == "windows")) {
warning("'pdf' has been set to FALSE because the OS is not ''windows''.")
Expand Down Expand Up @@ -291,7 +293,7 @@ rmd2word <- function(x, doc = "accessr",
ref_docx_dim = ref_docx_dim))
# Render the Word file
res1 <- rmarkdown::render(input = rmd_files[i], output_format = res0,
quiet = quiet)
params = params, quiet = quiet)
return(res1)
}
# Create Word documents
Expand Down
4 changes: 4 additions & 0 deletions man/rmd2word.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2ad8b4d

Please sign in to comment.