Skip to content

Commit

Permalink
use reformulate2 to address the backticking stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
zdz2101 committed Apr 26, 2024
1 parent 3ef9132 commit 2f5cc89
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions R/ard_survey_svycontinuous.R
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ accepted_svy_stats <- function(expand_quantiles = TRUE) {

# if no by variable, calculate univariate statistics
if (is_empty(by)) {
args$x <- stats::reformulate(variable)
args$x <- reformulate2(variable)
# calculate statistic (and remove FUN from the argument list)
stat <-
cards::eval_capture_conditions(
Expand Down Expand Up @@ -244,8 +244,8 @@ accepted_svy_stats <- function(expand_quantiles = TRUE) {

# if there is by variable(s), calculate statistics for the combinations
else {
args$formula <- stats::reformulate(variable)
args$by <- stats::reformulate(by)
args$formula <- reformulate2(variable)
args$by <- reformulate2(by)
stat <-
if (stat_name %in% c("median", paste0("p", 0:100))) {
cards::eval_capture_conditions(
Expand Down
2 changes: 1 addition & 1 deletion R/ard_survey_svyranktest.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ ard_survey_svyranktest <- function(data, by, variables, test, ...) {
variable = variable,
lst_tidy =
cards::eval_capture_conditions(
survey::svyranktest(stats::reformulate(by, response = variable), design = data, test = test, ...) |>
survey::svyranktest(reformulate2(termlabels = by, response = variable), design = data, test = test, ...) |>
broom::tidy()
)
)
Expand Down
2 changes: 1 addition & 1 deletion R/ard_survey_svyttest.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ ard_survey_svyttest <- function(data, by, variables, conf.level = 0.95, ...) {
variable = variable,
lst_tidy =
cards::eval_capture_conditions(
survey::svyttest(stats::reformulate(by, response = variable), design = data, ...) %>%
survey::svyttest(reformulate2(termlabels = by, response = variable), design = data, ...) %>%
# a slightly enhanced tidier that allows us to specify the conf.level
{
dplyr::bind_cols(
Expand Down

0 comments on commit 2f5cc89

Please sign in to comment.