if (requireNamespace('data.table', quietly = TRUE)) {
# don't multi-thread during CRAN checks
data.table::setDTthreads(1)
}
d <- data.frame(x = c(1, 2, 3), y = c(4, 5, 6))
xvar <- 'x' # the idea is, this is passed in and not known at coding time
yvar <- 'y'
# what we want:
# ggplot2::ggplot(data = d, mapping = ggplot2::aes_string(x = xvar, y = yvar)) +
# ggplot2::geom_point()
# The required "tidy evaluation ideoms[sic] with `aes()`".
ggplot2::ggplot(data = d, mapping = ggplot2::aes(!!!simulate_aes_string(x = xvar, y = yvar))) +
ggplot2::geom_point()
Run the code above in your browser using DataLab