Skip to content

Commit

Permalink
# 2521 remove lifecycle deprecation code for get_summary_records()
Browse files Browse the repository at this point in the history
Do I have this right??

Once removed, nothing stops user from using deprecated formal argument (such as `analysis_var`)   SEE test-get_summary_records.R   test #4
  • Loading branch information
jimrothstein committed Nov 17, 2024
1 parent 730c3c1 commit 686ae27
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
8 changes: 4 additions & 4 deletions R/get_summary_records.R
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,10 @@ get_summary_records <- function(dataset,
# I("get_summary_records(anaylsis_var = , summary_fun = )"),
# "get_summary_records(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)
#}
# 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)
# }

# Summarise the analysis value
dataset %>%
Expand Down
33 changes: 16 additions & 17 deletions tests/testthat/test-get_summary_records.R
Original file line number Diff line number Diff line change
Expand Up @@ -176,23 +176,22 @@ test_that("get_summary_records Test 4: Using deprecated formal argument will thr
"XYZ-1002", 9, "QTcF Int. (msec)", "Visit 3", "2016-03-24T10:56", 402, "Active 20mg"
)

expect_no_error(get_summary_records(
input,
by_vars = exprs(USUBJID, PARAM, AVISIT),
set_values_to = exprs(
AVAL = mean(AVAL, na.rm = TRUE),
DTYPE = "AVERAGE"
)))

expect_no_error(get_summary_records(
input,
by_vars = exprs(USUBJID, PARAM, AVISIT),
set_values_to = exprs(
AVAL = mean(AVAL, na.rm = TRUE),
DTYPE = "AVERAGE"
),
analysis_var = exprs(AVAL)
)
expect_no_error(get_summary_records(
input,
by_vars = exprs(USUBJID, PARAM, AVISIT),
set_values_to = exprs(
AVAL = mean(AVAL, na.rm = TRUE),
DTYPE = "AVERAGE"
)
))

expect_no_error(get_summary_records(
input,
by_vars = exprs(USUBJID, PARAM, AVISIT),
set_values_to = exprs(
AVAL = mean(AVAL, na.rm = TRUE),
DTYPE = "AVERAGE"
),
analysis_var = exprs(AVAL)
))
})

0 comments on commit 686ae27

Please sign in to comment.