What is a reprex and why is it useful?


  • Mentors and helpers usually need to run your code in order to help debug it.
  • Minimal reproducible examples make it possible for helpers to run your code, which lets them “feel your pain” and figure out what’s wrong.
  • Making a minimal reproducible example helps you understand your own problem and often leads to finding the answer yourself!
  • You can use the {reprex} package to test whether your example is reproducible.

Understanding your code


Identify the problem and make a plan


Minimal Reproducible Data


  • A minimal reproducible dataset contains (a) the minimum number of lines, variables, and categories, in the correct format, to reproduce a certain problem; and (b) it must be fully reproducible, meaning that someone else can reproduce the same problem using only the information provided.
  • You can create a dataset from scratch using as.data.frame, you can use available datasets like iris or you can use a subset of your own dataset
  • You can share your data by…

Minimal Reproducible Code


Asking your question


  • The {reprex} package makes it easy to format and share your reproducible examples.