I teach multiple R Courses where students have to submit an analysis they did on a specific dataset. As a first, (small) step towards reproducibility, I want to make sure the script they are submitting ran at least once on their local computer with the following constraints. It ran:
Until now, I've used RMarkdown / Quarto to "enforce" this. Rendering a R/Qmd file creates a new session for the code, which is executed from top to bottom, and by default errors halt the rendering process. The resulting output file (typically PDF or HTML) gives me confidence that the above requirements are met. (Of course, there are relatively easy ways to trick me, but these require malice, which I do not assume).
What I don't like about this approach is that the students are forced to work with R/Qmds rather than R-scripts. This generates additional overhead (e.g. when debugging) and sources of errors (issues related to RMarkdown / Quarto, rather than to the code).
Another approach would be to use targets
, which is a great package but also generates much overhead that would completely overwhelm the students (who are R and programming novices).
Can anyone recommend a different, simple approach to my problem?
One potential solution is the students use reprex to render their submissions.
Pros:
reprex::reprex(wd = ".", venue = "html")
to get a rendered html file and a markdown file in your 'current working directory' for submissionreprex(input = "my_reprex.R")
sessionInfo()
to the reprex (session_info = TRUE
) to help you support your students with troubleshooting/issues/bugs/etcCons:
Overall, I think it's a good option if the students read the docs and you provide clear instructions/expectations for the final submission file/s.