Reprex do’s and don’ts

If you’re asking for R help, reporting a bug, or requesting a new feature, you’re more likely to succeed if you include a good reprex.

Main requirements

Use the smallest, simplest, most built-in data possible.

Include commands on a strict “need to run” basis.

Consider including so-called “session info”, i.e. your OS and versions of R and add-on packages, if it’s conceivable that it matters.

Whitespace rationing is not in effect.

Pack it in, pack it out, and don’t take liberties with other people’s computers. You are asking people to run this code!

This seems like a lot of work!

Yes, creating a great reprex requires work. You are asking other people to do work too. It’s a partnership.

80% of the time you will solve your own problem in the course of writing an excellent reprex. YMMV.

The remaining 20% of the time, you will create a reprex that is more likely to elicit the desired behavior in others.

Further reading:

How to make a great R reproducible example? thread on StackOverflow

Package philosophy

The reprex code:

Accomplished like so: