Skip to content

Commit

Permalink
Merge pull request #12 from kamapu/devel
Browse files Browse the repository at this point in the history
Improved documentation for 'write_rmd()'
  • Loading branch information
kamapu authored Mar 11, 2023
2 parents b43b5c8 + c15da6b commit c01479b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
^examples$
^lab$
^LICENSE$
^\.travis\.yml$
^codecov\.yml$
^_pkgdown\.yml$
^docs$
^pkgdown$
^.*\.Rproj$
^\.Rproj\.user$
^tests$
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Description: Setting layout through 'YAML' headers in 'R-Markdown' documents,
Functions and methods may summarize 'R' objects in automatic reports, for
instance check-lists and further reports applied to the packages 'taxlist'
and 'vegtable'.
LazyData: true
SystemRequirements: pandoc (>= 1.14) - http://pandoc.org
Roxygen: list(markdown = TRUE)
License: GPL (>= 2)
Expand Down
7 changes: 5 additions & 2 deletions R/write_rmd.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#' @param object [rmd_doc-class] object used to write an Rmarkdown file. If
#' header is missing, `write_rmd()` will fail with an error message.
#' @param filename A character value with the name of the file to be written.
#' If not included, the extension *.Rmd will be appended to this name.
#' If missing, no file will be written by this function.
#' It is not necessary to include the extension *.Rmd in this argument.
#' If missing, the function will use the name of the input object.
#' @param ... Further arguments passed among methods (not yet used).
#'
#' @return
Expand Down Expand Up @@ -47,6 +47,9 @@ write_rmd <- function(object, ...) {
#' @method write_rmd rmd_doc
#' @export
write_rmd.rmd_doc <- function(object, filename, ...) {
if (missing(filename)) {
filename <- paste0(deparse(substitute(object)))
}
filename <- paste0(file_path_sans_ext(filename), ".Rmd")
con <- file(filename, "wb")
writeBin(
Expand Down
4 changes: 2 additions & 2 deletions man/write_rmd.Rd

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

0 comments on commit c01479b

Please sign in to comment.