tidyverse / reprex

Render bits of R code for sharing, e.g., on GitHub or StackOverflow.

Home Page:https://reprex.tidyverse.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Default packages

krlmlr opened this issue · comments

I'd like to make a case for an argument default_packages = getOption("reprex.default_packages") .

  • When loading conflicted, all those nasty deprecation warnings disappear
  • The number one issue for repeating the generation of a reprex is to forget to attach magrittr

Granted, the second issue is losing relevance with |>, but I would totally use options(reprex.default_packages = c("conflicted", "magrittr")) . The inserted library() calls would be inserted in front of the code that is copied from the clipboard.

Would you like to review a PR?

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union

Created on 2022-06-24 by the reprex package (v2.0.1)

library(conflicted)
library(dplyr)

Created on 2022-06-24 by the reprex package (v2.0.1)