Skip to content

Commit

Permalink
Removed unused argument tabular_format
Browse files Browse the repository at this point in the history
  • Loading branch information
sda030 committed Jul 27, 2024
1 parent d273210 commit 4d5e5d0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 32 deletions.
11 changes: 0 additions & 11 deletions R/draft_report.R
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,6 @@
#'
#' Path to log file. Set to NULL to disable logging.
#'
#' @param tabular_format *Serialized format*
#'
#' `scalar<string>` // *default:* `"delim"`
#'
#' Format for pretty tabular data, meant for end-user to peruse and will be
#' linked to in reports (the graph data, etc). One of `"delim"` (tab-separated delim-files)
#' `"xlsx"` requires `writexl`-package), `"csv"` or `"csv2"` (requires `readr`-package.
#' `"dta"` or `"sav"` requires `haven`-package. Currently must be specified,
#' in the future this will become an optional argument.
#'
#' @param serialized_format *Serialized format*
#'
#' `scalar<string>` // *default:* `"rds"`
Expand Down Expand Up @@ -217,7 +207,6 @@ draft_report <-
attach_chapter_dataset = TRUE,
auxiliary_variables = NULL,
serialized_format = c("rds", "qs"), # For attach_chapter_dataset
tabular_format = c("delim", "xlsx", "csv", "csv2", "tsv", "sav", "dta"),


max_path_warning_threshold = 260, # Tidy up argument name: max_width_path_warning. Keep here
Expand Down
14 changes: 4 additions & 10 deletions R/validate_draft_report_args.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ validate_draft_report_args <- function(params) {
# hide_chunk_if_n_below = list(fun = function(x) rlang::is_scalar_integerish(x) && x >= 0),

# Enums
tabular_format = list(fun = function(x) is.character(x) && any(env$tabular_format == x[1])),
serialized_format = list(fun = function(x) is.character(x) && any(env$serialized_format == x[1]))

)
Expand All @@ -70,19 +69,14 @@ validate_draft_report_args <- function(params) {
validation_fun = arg_params[[par]]$fun)
}

params$tabular_format <- params$tabular_format[1]
params$serialized_format <- params$serialized_format[1]


pkg <- switch(params$tabular_format,
"delim" = "utils",
"xlsx" = "openxlsx",
"csv" = "readr",
"tsv" = "readr",
"sav" = "haven",
"dta" = "haven")
pkg <- switch(params$serialized_format,
"qs" = "qs",
"rds" = "base")
if(!requireNamespace(pkg, quietly = TRUE)) {
cli::cli_abort("Needs {.pkg {pkg}} to use {.arg tabular_format}={params$tabular_format}: {.run [install.packages(pkg)](install.packages())}")
cli::cli_abort("Needs {.pkg {pkg}} to use {.arg serialized_format}={params$serialized_format}: {.run [install.packages(pkg)](install.packages())}")
}

params
Expand Down
11 changes: 0 additions & 11 deletions man/draft_report.Rd

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

0 comments on commit 4d5e5d0

Please sign in to comment.