Skip to content

Commit

Permalink
R CMD CHECK
Browse files Browse the repository at this point in the history
  • Loading branch information
graemeblair committed Feb 28, 2019
1 parent 5ed94c9 commit 8ed5645
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Depends:
fabricatr (>= 0.6.0),
estimatr (>= 0.14.0)
Imports:
rlang, generics
rlang, generics, diffobj
License: MIT + file LICENSE
URL: https://declaredesign.org, https://github.com/DeclareDesign/DeclareDesign
BugReports: https://github.com/DeclareDesign/DeclareDesign/issues
Expand Down
5 changes: 4 additions & 1 deletion R/compare_designs.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
#' @param design2 A design object, typically created using the + operator
#' @param format Format (in console or HTML) options from \code{diffobj::diffChr}
#' @param mode Mode options from \code{diffobj::diffChr}
#' @param ... Options sent to \code{diffobj::diffChr}
#' @param pager Pager option from \code{diffobj::diffChr}
#' @param context Context option from \code{diffobj::diffChr}
#' @param x A design comparison object created by \code{compare_designs}
#' @param ... Options for printing design comparison object
#'
#' @examples
#'
Expand Down
17 changes: 16 additions & 1 deletion R/design_helper_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,22 @@ print_code <- function(design) {
# and the call for the declare step

if (is.null(attributes(design)$code)) {
get_design_code(design)
clean_call <- function(call) {
paste(sapply(deparse(call), trimws), collapse = " ")
}

# print each step

for (i in seq_along(design)) {
# only print steps that are not calls within the design call i.e. mutate(q = 5)
if (inherits(attributes(design[[i]])$call, "call")) {
cat(names(design)[i], "<-", clean_call(attributes(design[[i]])$call), "\n\n")
}
}

# print the design declaration

cat("my_design <-", clean_call(attributes(design)$call), "\n\n")
} else {
print(attributes(design)$code)
}
Expand Down
8 changes: 7 additions & 1 deletion man/compare_functions.Rd

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

0 comments on commit 8ed5645

Please sign in to comment.