Skip to content
Prev 6876 / 12125 Next

[R-pkg-devel] Using ggplot2 within another package

Hi everyone,
One suggestion would be import ggplot2 and using tidy eval operators to
create a function. One simple reproducible example would be

library(ggplot2)
my_hist <- function(df, var){
  ggplot(df, aes({{var}})) +
    geom_histogram()
}

df <- data.frame(my_var = rnorm(400, 10, 2))
my_hist(df = df, var = my_var)

All the best
Tiago

Em sex., 23 de abr. de 2021 ?s 09:04, Mike Collyer <mlcollyer at gmail.com>
escreveu: