To use reprex, do the following steps:
- load the reprex package by using the command
library(reprex)
- Copy the code you want to run into reprex - don't copy what went to the console. It shouldn't have the > at the beginning of lines, this is just the code. Note you need to include everything including reading in data as the reprex is a standalone session and won't use what is in your environment
- Run the command
reprex()
. This will run whatever you have copied.
This video might be helpful: [Video] Reproducible Examples and the `reprex` package