Skip to content

Commit

Permalink
Set focus to new and used columns after mutate()
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Aug 28, 2022
1 parent f2fb03c commit 4204ca9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,5 @@ Config/Needs/website:
shiny,
pkgdown,
tidyverse/tidytemplate
Remotes:
r-lib/pillar@f-focus-attr
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(cols_retain, c(cols_expr, cols_used))
out
}

#' @rdname mutate
Expand Down

0 comments on commit 4204ca9

Please sign in to comment.