diff --git a/.Rbuildignore b/.Rbuildignore index 4ef26d0..cdd68b8 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -8,3 +8,6 @@ docs/.* ^\.github$ ^\.covrignore$ prepare_development_branch.sh +cran-comments.md +^doc$ +^Meta$ diff --git a/.gitignore b/.gitignore index 9d0a714..e967e75 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ devel/* .Rhistory *.Rproj +inst/doc +doc +Meta diff --git a/.travis.yml b/.travis.yml index 73fd66f..493b001 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,5 @@ language: r r: - - 3.2 - - 3.3 - 3.4 - 3.5 - 3.6 @@ -11,10 +9,6 @@ os: - osx jobs: exclude: - - r: 3.2 - os: osx - - r: 3.3 - os: osx - r: devel os: osx after_success: diff --git a/DESCRIPTION b/DESCRIPTION index fa6805a..46cf5fb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,17 +1,16 @@ Package: heddlr Title: Dynamic R Markdown Document Generation -Version: 0.3.0 +Version: 0.3.1 Authors@R: person(given = "Michael", family = "Mahoney", role = c("aut", "cre"), email = "mike.mahoney.218@gmail.com", comment = c(ORCID = "https://orcid.org/0000-0003-2402-304X")) -Description: heddlr is a package designed to make - dynamically generating R Markdown documents easier, by providing an - easy way to create section patterns, define how those patterns work - together to form a template, and then using data to generate a report - that fits your templating needs. +Description: Helper functions designed to make + dynamically generating R Markdown documents easier by providing a + simple and tidy way to create report pieces, shape them to your data, + and combine them for exporting into a single R Markdown document. License: MIT + file LICENSE Depends: R (>= 3.2.5) @@ -26,7 +25,12 @@ Suggests: roxygen2, testthat (>= 2.1.0), dplyr, - tidyr + tidyr, + nycflights13, + ggplot2, + knitr, + purrr Encoding: UTF-8 LazyData: true RoxygenNote: 6.1.1 +VignetteBuilder: knitr diff --git a/NAMESPACE b/NAMESPACE index 013daf7..b14946c 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,5 +1,9 @@ # Generated by roxygen2: do not edit by hand +S3method(heddle,data.frame) +S3method(heddle,default) +S3method(make_template,data.frame) +S3method(make_template,default) export(":=") export(.data) export(as_label) @@ -8,6 +12,7 @@ export(assemble_draft) export(create_yaml_header) export(enquo) export(enquos) +export(export_template) export(expr) export(heddle) export(import_pattern) @@ -21,6 +26,5 @@ importFrom(rlang,as_name) importFrom(rlang,enquo) importFrom(rlang,enquos) importFrom(rlang,expr) -importFrom(rlang,set_names) importFrom(rlang,sym) importFrom(rlang,syms) diff --git a/NEWS.md b/NEWS.md index fccbdcf..57f2516 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,19 @@ +# Version 0.3.1 (2019-12-29) + +* New vignettes introducing the concepts behind heddlr +* New hidden docs pages to be linked from vignettes and other docs +* Fixed a few latent bugs in heddle: + * Export methods in order to, well, use the methods +* Fixed a few latent bugs in make_template: + * Export methods in order to, well, use the methods + * Fix vector handling so nested vectors are flattened properly +* Export export_template and fix documentation +* Internal changes (only build on R 3.4 and up, change description to pass + R CMD check) +* Add Suggests for vignettes + + + # Version 0.3.0 (2019-12-28) * Implement `heddle` function, making it easy to swap out placeholder keywords diff --git a/R/create_yaml_header.R b/R/create_yaml_header.R index 27dd9e7..2f6c89b 100644 --- a/R/create_yaml_header.R +++ b/R/create_yaml_header.R @@ -38,7 +38,6 @@ create_yaml_header <- function(..., header.content <- vector("list") for (i in seq_along(yaml.parts)) { - if (length(names(yaml.parts[i])) == 0) { header.content <- c(header.content, yaml.parts[[i]]) } else if (names(yaml.parts[i]) == "") { diff --git a/R/export_template.R b/R/export_template.R index 917f940..c99f165 100644 --- a/R/export_template.R +++ b/R/export_template.R @@ -1,7 +1,7 @@ #' Safely export templates to file. #' #' This is a simple wrapper function around \code{\link[utf8]{as_utf8}} and -#' \code{\link{[base]{writeLines}}, letting users write their template strings +#' \code{\link[base]{writeLines}}, letting users write their template strings #' to file without having to worry about file encodings. For more details on #' why UTF-8 encoding is necessary, check out #' [Yihui Xie's](https://yihui.org/en/2018/11/biggest-regret-knitr/) post on @@ -24,6 +24,8 @@ #' filename parameter is expected to be a string (that is, a character #' vector). Setting the value to FALSE disables the warning when a #' non-character argument is passed, but this is unsupported functionality. +#' +#' @export export_template <- function(template, filename, diff --git a/R/heddle.R b/R/heddle.R index 5ad1bec..f67be4d 100644 --- a/R/heddle.R +++ b/R/heddle.R @@ -23,6 +23,7 @@ heddle <- function(data, pattern, ..., strip.whitespace = F) { UseMethod("heddle") } +#' @export heddle.default <- function(data, pattern, ..., strip.whitespace = F) { dots <- list(...) if (length(dots) == 0) stop("argument '...' is missing, with no default") @@ -45,6 +46,7 @@ heddle.default <- function(data, pattern, ..., strip.whitespace = F) { ) } +#' @export heddle.data.frame <- function(data, pattern, ..., strip.whitespace = F) { dots <- enquos(...) if (any(names(dots) == "") || any(is.null(names(dots)))) { diff --git a/R/make_template.R b/R/make_template.R index 87bcbe2..d050f33 100644 --- a/R/make_template.R +++ b/R/make_template.R @@ -14,18 +14,20 @@ make_template <- function(data, ...) { UseMethod("make_template") } +#' @export make_template.default <- function(data, ...) { dots <- list(...) - output <- vector("character", length(dots) + 1) + output <- vector("list", length(dots) + 1) output[[1]] <- paste0(data, collapse = "") if (length(dots) != 0) { for (i in 1:length(dots)) { - output[[i + 1]] <- paste0(dots[[i]], collapse = "") + output[[i + 1]] <- paste0(unlist(dots[[i]]), collapse = "") } } - paste0(output, collapse = "") + paste0(unlist(output), collapse = "") } +#' @export make_template.data.frame <- function(data, ...) { dots <- enquos(...) if (length(dots) == 0) stop("argument '...' is missing, with no default") diff --git a/R/utils-tidy-eval.R b/R/utils-tidy-eval.R index 5bddb45..af7c474 100644 --- a/R/utils-tidy-eval.R +++ b/R/utils-tidy-eval.R @@ -41,7 +41,7 @@ #' @md #' @name tidyeval #' @keywords internal -#' @importFrom rlang expr enquo enquos sym syms set_names .data := as_name as_label +#' @importFrom rlang expr enquo enquos sym syms .data := as_name as_label #' @aliases expr enquo enquos sym syms .data := as_name as_label #' @export expr enquo enquos sym syms .data := as_name as_label NULL diff --git a/README.md b/README.md index baed144..daa758d 100644 --- a/README.md +++ b/README.md @@ -150,9 +150,3 @@ compatible with `heddlr`, because `heddlr` just doesn’t care what your end result will look like – its only goal is to make it easier for you to get there. -Code of Conduct ---------------- - -Please note that the ‘heddlr’ project is released with a [Contributor -Code of Conduct](.github/CODE_OF_CONDUCT.md). By contributing to this project, -you agree to abide by its terms. diff --git a/cran-comments.md b/cran-comments.md new file mode 100644 index 0000000..889adbc --- /dev/null +++ b/cran-comments.md @@ -0,0 +1,22 @@ +## Test environments +* Local Ubuntu 19.04 install, R 3.6.2 +* Linux 16.04 (travis-ci), R devel, 3.6.2, 3.5.3, 3.4.4 +* Mac OSX (travis-ci), R 3.6.2, 3.5.3, 3.4.4 +* win-builder (devel and release) + +## R CMD check results + +There were no ERRORs or WARNINGs. + +There was one NOTE: + +* checking CRAN incoming feasibility ... NOTE +Maintainer: 'Michael Mahoney ' + +New submission + +This is my first submission of this or any package. + +## Downstream Dependencies + +There are currently no downstream dependencies for this package. diff --git a/docs/404.html b/docs/404.html index 0abe0c7..1db2f89 100644 --- a/docs/404.html +++ b/docs/404.html @@ -67,7 +67,7 @@ heddlr - 0.3.0 + 0.3.1 @@ -81,6 +81,21 @@
  • Reference +
  • + +
  • + Changelog