Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrap_elements not capturing environment when used in a (separate) function #138

Closed
vnijs opened this issue Dec 5, 2019 · 0 comments
Closed

Comments

@vnijs
Copy link

vnijs commented Dec 5, 2019

See example below. Any suggestions?

library(patchwork)
make_plot <- function() {
  hc <- hclust(dist(USArrests), "ave")
  patchwork::wrap_elements(~ plot(hc))
}

plot_list <- list()
plot_list[[1]] <- make_plot()
patchwork::wrap_plots(plot_list, ncol = 1)

Output:

Error in plot(hc) : object 'hc' not found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant