Skip to content

Commit

Permalink
feat: #2142 get a good clean slate
Browse files Browse the repository at this point in the history
  • Loading branch information
Zelos Zhu committed Oct 24, 2023
1 parent e5a01a3 commit 0e6ec6c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
32 changes: 12 additions & 20 deletions R/derive_summary_records.R
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,6 @@ derive_summary_records <- function(dataset,
)
assert_varval_list(set_values_to, optional = TRUE)
assert_expr_list(missing_values, named = TRUE, optional = TRUE)

if (!missing(analysis_var) || !missing(summary_fun)) {
deprecate_warn(
"1.0.0",
I("derive_summary_records(anaylsis_var = , summary_fun = )"),
"derive_summary_records(set_values_to = )"
required_vars = by_vars
)
assert_varval_list(set_values_to)

if (!missing(analysis_var) || !missing(summary_fun)) {
Expand All @@ -179,18 +171,18 @@ derive_summary_records <- function(dataset,
}

# Summarise the analysis value and bind to the original dataset
bind_rows(
dataset,
get_summary_records(
dataset,
by_vars = by_vars,
filter = !!filter,
set_values_to = set_values_to
)
analysis_var <- assert_symbol(enexpr(analysis_var))
assert_s3_class(summary_fun, "function")
set_values_to <- exprs(!!analysis_var := {{ summary_fun }}(!!analysis_var), !!!set_values_to)
}
# bind_rows(
# dataset,
# get_summary_records(
# dataset,
# by_vars = by_vars,
# filter = !!filter,
# set_values_to = set_values_to
# )
# analysis_var <- assert_symbol(enexpr(analysis_var))
# assert_s3_class(summary_fun, "function")
# set_values_to <- exprs(!!analysis_var := {{ summary_fun }}(!!analysis_var), !!!set_values_to)
# }

if (is.null(dataset_add)) {
dataset_add <- dataset
Expand Down
6 changes: 3 additions & 3 deletions R/get_summary_records.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@
#'
#' @return A data frame of derived records.
#'
#' @family der_gen
#' @family superseded
#'
#' @keywords der_gen
#' @keywords internal
#'
#' @seealso [derive_summary_records()], [derive_var_merged_summary()]
#'
Expand Down Expand Up @@ -162,14 +162,14 @@ get_summary_records <- function(dataset,
analysis_var,
summary_fun,
set_values_to = NULL) {
# lifecycle::signal_stage("superseded", "get_summary_records()", "derive_summary_records(dataset_add= )")
inform(
message = paste0(
"`get_summary_records()` has been superseded, ",
"please use the `dataset_add` argument in `derive_summary_records()`",
sep = ""
)
)
set_values_to) {
assert_vars(by_vars)
filter <- assert_filter_cond(enexpr(filter), optional = TRUE)
assert_data_frame(
Expand Down

0 comments on commit 0e6ec6c

Please sign in to comment.