Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POC: Set focus to new and used columns after mutate() #6252

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Imports:
tidyselect (>= 1.1.2.9000),
utils,
vctrs (>= 0.4.1.9000),
pillar (>= 1.5.1)
pillar (>= 1.8.1)
Suggests:
bench,
broom,
Expand Down
6 changes: 5 additions & 1 deletion R/compute-collect.r
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ collapse <- function(x, ...) {
}

#' @export
collect.data.frame <- function(x, ...) x
collect.data.frame <- function(x, ...) {
attr(x, "pillar_focus") <- NULL
x
}

#' @export
compute.data.frame <- function(x, ...) x
#' @export
Expand Down
4 changes: 3 additions & 1 deletion R/mutate.R
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ mutate.data.frame <- function(.data,
cols_retain <- setdiff(cols_out, c(cols_used, cols_unused))
}

dplyr_col_select(out, cols_retain)
out <- dplyr_col_select(out, cols_retain)
attr(out, "pillar_focus") <- intersect(c(cols_expr, cols_used), cols_retain)
out
}

#' @rdname mutate
Expand Down
8 changes: 8 additions & 0 deletions R/utils.r
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,11 @@ node_walk_replace <- function(node, old, new) {
node <- node_cdr(node)
}
}

# Stop tests from failing due to new attribute
# TODO: make this only affect tests
compare_proxy.data.frame <- function(x, path = "x") {
attr(x, "pillar_focus") <- NULL
list(object = x, path = path)
}
on_load(s3_register("waldo::compare_proxy", "data.frame"))