reprex 2.0.0

When the clipboard isn’t available

We’ve made reprex more pleasant to use in settings where we cannot access the user’s clipboard from R. Specifically, this applies to use on RStudio Server and RStudio Cloud.

Filepaths

wd is a new argument to set the reprex working directory. As a result, the outfile argument is deprecated and the input argument has new significance. Here’s how to use input and wd to control reprex filepaths:

Various changes mean that more users will see reprex filepaths. Therefore, we’ve revised them to be more self-explanatory and human-friendly. When reprex needs to invent a file name, it is now based on a random “adjective-animal” slug. Bring on the angry-hamster!

.Rprofile

reprex() renders the reprex in a separate, fresh R session using callr::r(). As of callr 3.4.0 (released 2019-12-09), the default became callr::r(..., user_profile = "project"), which means that callr executes a .Rprofile found in current working directory. Most reprexes happen in a temp directory and there will be no such .Rprofile. But if the user intentionally reprexes in an existing project with a .Rprofile, callr::r() and therefore reprex() honor it. In this version of reprex:

These changes are of special interest to users of the renv package, which uses .Rprofile to implement a project-specific R package library. Combined with the filepath changes (described above), this means an renv user can call reprex(wd = "."), to render a reprex with respect to a project-specific library.

Other

HTML preview should work better with more ways of using reprex_render(), i.e. usage that doesn’t come via a call to reprex() (#293).

Dependency changes

reprex 1.0.0

Venues

Implementation and internals

Other changes and improvements

Dependency changes

R 3.1 and R 3.2 are no longer explicitly supported or tested. Our general practice is to support the current release (4.0, at time of writing), devel, and the 4 previous versions of R (3.6, 3.5, 3.4, 3.3).

reprex 0.3.0

reprex 0.2.1

reprex 0.2.0

reprex has a website: https://reprex.tidyverse.org. It includes a contributed article from @njtierney (#103).

reprex has moved to the tidyverse Organization. It is installed as part of the tidyverse meta-package and is suggested to those seeking help.

reprex() gains several arguments and many arguments can now be controlled via an option, in case a user wants their own defaults.

The new reprex_selection() add-in reprexes the current selection, with venue controlled by the option reprex.venue. It can be handy to bind to a keyboard shortcut (#84 @hadley).

If reprex can’t write to the user’s clipboard (e.g. on RStudio server or Unix-like systems lacking xclip or xsel), it offers to open the output file for manual copy.

Option-controlled arguments for custom defaults

These look like reprex(..., arg = opt(DEFAULT), ...) in the help file. This is shorthand for arg = getOption("reprex.arg", DEFAULT), i.e. the option reprex.arg is consulted and, if unset, the documented default is used. Allows user to define their own default behaviour (#116).

New arguments to reprex():

Venues

Other changes

reprex 0.1.2

This was a non-functioning release created by CRAN maintainers by commenting out lines of code relating to the clipboard.

reprex 0.1.1

reprex 0.1.0

reprex 0.0.0.9000