Software
reprex

reprex

Render bits of R code for sharing, e.g., on GitHub or StackOverflow.

R

The reprex package helps R users create minimal, reproducible examples of their code along with its output, formatted for sharing on platforms like GitHub, Stack Overflow, Slack, or in presentations. It takes R code from various sources (clipboard, files, or direct input), runs it, and returns the code with its output in a format optimized for your chosen platform.

reprex solves the common problem of sharing code that others can immediately run and understand when asking for help or reporting bugs. It automatically handles rendering through rmarkdown, supports multiple output formats (Markdown, HTML, R script, or RTF), uploads plots to imgur, and can strip prompts from pasted console output. The package also includes utilities to extract clean code from existing reprexes found online.

Contributors