(That's not a reprex, by the way.)

This might be useful, as might this and this

Here's some more playing around with this that I've done:

```
library(tidyverse)
# This doesn't quite give you the output you suggest, but it shows how the `.data` pronoun can be used in an anonymous function
vars <- c("Sepal.Length", "Sepal.Width", "Petal.Length")
plots <- map(vars, function(var) {
iris %>% ggplot(aes(x = .data[[var]])) + geom_histogram()
})
# however it doesn't seem to work well within the tibble structure you suggest
iris_plots <-
tibble(
vars = vars,
plots = map(vars, function(var) {
iris %>% ggplot(aes(x = .data[[var]])) + geom_histogram()
})
)
iris_plots$plots
#> [[1]]
#> Error: Unknown input: function
# I thought it might work better with `mutate`, but no
iris_plots <-
tibble(
vars = vars) %>%
mutate(plots = across(vars, function(var) {
iris %>% ggplot(aes(x = .data[[var]])) + geom_histogram()
})
)
#> Error: Problem with `mutate()` column `plots`.
#> i `plots = across(...)`.
#> x Input must be a vector, not a <gg/ggplot> object.
# however you can just make your tibble like this:
iris_plots <-
tibble(
vars = vars,
plots = plots
)
iris_plots$plots
#> [[1]]
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
```

```
#>
#> [[2]]
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
```

```
#>
#> [[3]]
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
```

^{Created on 2021-10-04 by the reprex package (v2.0.1)}