Closed yutannihilation closed 3 years ago
Fix #143
In the following dplyr::transmute(), a column name x in y = x refers to the previously generated column x, which is actually other_col.
dplyr::transmute()
x
y = x
other_col
data <- data.frame(x = 1, y = 2, other_col = 3) dplyr::transmute(data, x = other_col, y = x )
To ensure the variable refers to the original column, the expressions needs to be wrapped by data.frame and let it get auto-unspliced.
library(patchwork) devtools::load_all("~/repo/gghighlight/") #> ℹ Loading gghighlight #> Loading required package: ggplot2 set.seed(22) df <- tibble::tibble( week = rep(1:3, each = 3), values = runif(9), x = values, id = rep(c("a", "b", "c"), times = 3) ) p1 <- ggplot(df, aes(week, values, colour = id)) + geom_line() + gghighlight(id == "a") #> Warning: Tried to calculate with group_by(), but the calculation failed. #> Falling back to ungrouped filter operation... #> label_key: id p2 <- ggplot(df, aes(week, x, colour = id)) + geom_line() + gghighlight(id == "a") #> Warning: Tried to calculate with group_by(), but the calculation failed. #> Falling back to ungrouped filter operation... #> label_key: id p1 * p2
Created on 2021-06-05 by the reprex package (v2.0.0)
Fix #143
In the following
dplyr::transmute()
, a column namex
iny = x
refers to the previously generated columnx
, which is actuallyother_col
.To ensure the variable refers to the original column, the expressions needs to be wrapped by data.frame and let it get auto-unspliced.
Created on 2021-06-05 by the reprex package (v2.0.0)