Skip to content

Commit

Permalink
simplify name injection in dplyr funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
eutwt committed Dec 31, 2023
1 parent fc7ca72 commit 0329d1a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions R/value-diffs.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ value_diffs <- function(comparison, column) {
col <- names(column_loc)
a <- comparison$input$value$a %>%
fsubset(diff_rows$row_a, col) %>%
rename(!!glue("{col}_a") := !!sym(col))
rename("{col}_a" := !!sym(col))
b <- comparison$input$value$b %>%
fsubset(diff_rows$row_b, c(col, comparison$by$column)) %>%
rename(!!glue("{col}_b") := !!sym(col))
rename("{col}_b" := !!sym(col))
tibble(a, b)
}

Expand Down
4 changes: 2 additions & 2 deletions R/weave-diffs.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ weave_diffs_wide <- function(comparison, column = everything()) {

reduce(.init = slice_a, diff_cols, \(x, col) {
x %>%
mutate(!!glue("{col}_b") := slice_b[[col]], .after = !!sym(col)) %>%
rename(!!glue("{col}_a") := !!sym(col))
mutate("{col}_b" := slice_b[[col]], .after = !!sym(col)) %>%
rename("{col}_a" := !!sym(col))
})
}

0 comments on commit 0329d1a

Please # to comment.