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 your
code chunkand get the same error.
How do I format my text so it has nice
- 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.
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 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.
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
Help asking R-related questions (not specific to the
- 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