Data Challenge Lab Home

Getting help [communicate]

(Builds on: Documentation)
(Leads to: Learning more)

Jenny Bryan and Hadley Wickham

Help yourself

Get help from others

If someone has the wit and knowledge to answer your question, they probably have other things they would like to do. Making your message clear, concise and user-friendly gives you the best hope of at least one of those strangers diverting their attention away from their life towards your problem.

— The 9th circle of The R Inferno

If you need help getting unstuck, the first step is to create a reprex, or reproducible example. The goal of a reprex is to package your problematic code in such a way that other people can run it and feel your pain. Then, hopefully, they can provide a solution and put you out of your misery.

There are two parts to creating a reprex:

That sounds like a lot of work! And it can be, but it has a great payoff:

The reprex package

When creating a reprex by hand, it’s easy to accidentally miss something that means your code can’t be run on someone else’s computer. Avoid this problem by using the reprex package. It’s installed as part of the tidyverse. Go ahead and load it.


Write a bit of code and copy it to the clipboard:

(y <- 1:4)

Enter reprex() in the R Console. In RStudio, you’ll see a preview of your rendered reprex.

(y <- 1:4)
#> [1] 1 2 3 4
#> [1] 2.5

It is now ready and waiting on your clipboard, so you can paste it into, say, a GitHub issue. In RStudio, you can access reprex from the addins menu, which makes it even easier to point out your code and select the output format.

If your code is not self-contained, running reprex() results in an error. It may feel like tough love, but this way you can get your story straight in private. The reprex format also strongly encourages you to find the minimal dataset necessary to show your problem. Creating an effective reprex is a learned skill and the immediate feedback from reprex makes this very concrete.

More resources on asking good questions