[Video] Reproducible Examples and the `reprex` package

September 21, 2018 @jennybryan Jenny Bryan

@jennybryan wrote:

Reproducible Examples and the reprex package.

Basic usage of reprex
Motivation, why use reprex? "Help me help you"

Define reprex? Three commons ways to use the term.

  1. noun, a reproducible example
  2. the reprex package. a tool to build R reprexs
  3. reprex::reprex(), a function in reprex to make a reprex.

When should you use a reprex?

reprex installation and setup - How do you actually get repex on your machine?

Why does the reprex package exist?
Anyone who has helped teach R or dealt with github issues, twitter, stack overflow & RStudio community questions knows that helping people diagnose their coding problems can be hard.
This tool comes from hard-won experience. It’s aim to is help people ask well formed questions and increase the chances of getting well formed answers quickly.

philosophy behind reprex

  1. code that I can run.
    Tips on writing good reprexs. Dos and don'ts.
    How do I get my data into my reprex? - Getting small data and CSV type data into your reprex is easy.
    “I have a big hairy data object and I can only show their problem by using it”, but that's not always the case.
  2. code that I don't need to run - reprex gives your reader the code and reveals the output being produced by that code. For experienced coders, that might be enough to help you.
  3. code that I can easily run - Don't copy and paste from the R console. This is usually annoying for your reader. Worse than console copy-pasta is the screenshot. (Many people think screenshots of code are downright offensive.)

reprex_clean - If you copy someone else's reprex into your consolve, it may include their output, making your new reprex a untidy. Here are tips for taking someone else's reprex code and output, and create a clean reprex reply.

Shock and Awe - Additional interesting features of the reprex package.

Set up personal defaults for your reprex usage.

reprex RStudio addins; render reprex and reprex selection. These accelerate your use of reprex.

The human side of reproducible examples.
How to ask questions in ways that are most likely to get answered.
Sorry for the tough love, but this is important. Why are you always asked to give a reprex?

  • Experts try to use reproducible examples to ensure their advice works.
  • Making a good reprex is hard. But, you are asking them to solve a problem for you, so meet them halfway.
  • Creating reprexes is good coding practice.
  • Making a good reprex is often a good way to debug your issue in the embarrassment-free privacy of your own home.
  • reprexes lead to discussions more likely to help people in the future.

Behind the scenes of reprex

Thanks for those that helped make reprex possible.

Questions and Answers

Posts: 2

Participants: 2

Read full topic

Previous Article
Using a pipe to sequentially filter data - receiving error
Using a pipe to sequentially filter data - receiving error

@ppines wrote: For some reason the equal sign in the last filter item is causing...

Next Article
Secure way to accept user input for shiny apps
Secure way to accept user input for shiny apps

@Mathematics wrote: Hello ... I am using R shiny to develop mathematics APPS whe...