Skip to content

Commit 75cc3fe

Browse files
committed
Fix no visible binding for convert_monthly_rows_to_vars
1 parent e6584c5 commit 75cc3fe

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

R/convert_monthly_rows_to_vars.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@ convert_monthly_rows_to_vars <- function(data,
1717
month_order <- tolower(month.abb[c(4L:12L, 1L:3L)])
1818

1919
data %>%
20-
dplyr::mutate(month_name = month_order[{{ month_num_var }}]) %>%
21-
dplyr::select(-{{ month_num_var }}) %>%
20+
dplyr::mutate(month_name = month_order[.data[[month_num_var]]]) %>%
21+
dplyr::select(-all_of(month_num_var)) %>%
2222
dplyr::rename(
23-
cost = {{ cost_var }},
24-
beddays = {{ beddays_var }}
25-
) %>%
23+
cost = all_of(cost_var),
24+
beddays = all_of(beddays_var)
25+
) %>%
2626
tidyr::pivot_wider(
2727
names_from = "month_name",
2828
names_glue = "{month_name}_{.value}",
2929
values_from = c("cost", "beddays"),
3030
values_fill = 0.00
31-
) %>%
31+
) %>%
3232
dplyr::select(
3333
!dplyr::ends_with(c("_beddays", "_cost")),
3434
dplyr::any_of(paste0(month_order, "_beddays")),
3535
dplyr::any_of(paste0(month_order, "_cost"))
36-
)
36+
)
3737
}

R/process_extract_acute.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ process_extract_acute <- function(data,
6161
# Apply new costs for C3 specialty, these are taken from the 2017/18 file
6262
fix_c3_costs(year) %>%
6363
# initialise monthly cost/beddays variables in a separate data frame for matching
64-
convert_monthly_rows_to_vars(costmonthnum, cost_total_net, yearstay) %>%
64+
convert_monthly_rows_to_vars("costmonthnum", "cost_total_net", "yearstay") %>%
6565
# add yearstay and cost_total_net variables
6666
dplyr::mutate(
6767
yearstay = rowSums(dplyr::pick(tidyselect::ends_with("_beddays"))),

R/process_extract_mental_health.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ process_extract_mental_health <- function(data, year, write_to_disk = TRUE) {
5050
) %>%
5151
# monthly beddays and costs
5252
convert_monthly_rows_to_vars(
53-
costmonthnum,
54-
cost_total_net,
55-
yearstay
53+
"costmonthnum",
54+
"cost_total_net",
55+
"yearstay"
5656
) %>%
5757
dplyr::mutate(
5858
# yearstay

0 commit comments

Comments
 (0)