Skip to content

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

@vnijs

Description

@vnijs

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions