Writing a Minimal Working Example (MWE) in R

Writing a Minimal Working Example (MWE) in R by Jared Knowles.

From the post:

How to Ask for Help using R

The key to getting good help with an R problem is to provide a minimally working reproducible example (MWRE). Making an MWRE is really easy with R, and it will help ensure that those helping you can identify the source of the error, and ideally submit to you back the corrected code to fix the error instead of sending you hunting for code that works. To have an MWRE you need the following items:

  • a minimal dataset that produces the error
  • the minimal runnable code necessary to produce the data, run on the dataset provided
  • the necessary information on the used packages, R version, and system
  • a seed value, if random properties are part of the code

Let’s look at the tools available in R to help us create each of these components quickly and easily.

R specific but the general principles apply to any support question.

Pointers to other language/software specific instructions for support questions?

Even heavier requirements obtain in development environments:


Comments are closed.