Why reprex?
Getting unstuck is hard. Your first step here is usually to create a reprex, or reproducible example. The goal of a reprex is to package your code, and information about your problem so that others can run it and feel your pain. Then, hopefully, folks can more easily provide a solution.
What's in a Reproducible Example?
Parts of a reproducible example:
- background information - Describe what you are trying to do. What have you already done?
- complete set up - include any
library()
calls and data to reproduce your issue.
data for a reprex: Here's a discussion on setting up data for a reprex - make it run - include the minimal code required to reproduce your error on the data provided.
People should be able to copy and paste yourcode chunk
and get the same error.
How do I format my text so it has nicecode chunks
? - minimal - strip away everything that is not directly related to your problem. This usually involves creating a much smaller and simpler set of code and data compared to that which created your issue.
Use the reprex
-package to Build Your Reproducible Example
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.
The reprex
package will save effort for you and others who want to help.
Personal and Private Information
Users should not share personal or protected information in topic threads or reprex data.
What if you need to share contact info or an ip, or discuss data for a reprex related to a protected dataset? What if you see a violation of this policy? Check out Personally Identifiable & Protected Information Guide guide and our Privacy Policy
Beginners - Step by Step Help
- Here's a nice introduction to reproducible examples focused on a community.rstudio.com example
- Here's a video on reproducible examples and the
reprex
package, - FAQ: How to do a minimal reproducible example ( reprex ) for beginners
Help asking R-related questions (not specific to the reprex
-package)
- StackOverflow: How to make a great R reproducible example? aka MCVE
- Three tips for posting good questions to R-help and Stack Overflow
- The R Inferno, Circle 9: Unhelpfully Seeking Help
Background on the reprex
-package
- reprex GitHub repo - code, motivation and examples.
- rOpenSci community call Jenny Bryan introduces
reprex
(~10:40 in reprex begins)