knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
The reprex
package creates reproducible examples of code bugs to be shared in GitHub issues. projmgr
plays nice with reprex
to help post reproducible examples and pull them back down for evaluation.
Much like other types of issues, projmgr
make it easy to post issues containing reprexes to GitHub.
For example, suppose you have the problematic code on your clipboard, open in a file, or somewhere that reprex
can find it (refer to the reprex
package documentation for details). You could post this as the body of an issue with the following code:
reprex::reprex(venue = "gh") post_issue(projmgr, title = "this is a descriptive title of my issue", body = paste( clipr::read_clip(), collapse = "\n") )
Suppose you see on GitHub that a user posted an issue, say number 82, with a reprex. You can use projmgr
to copy and run their code back in R. (Admittedly, its hard to imagine this has significant benefits over copying from GitHub.)
For example:
# get issue in question from repo experigit <- create_repo_ref('emilyriederer', 'experigit') issue <- get_issues(experigit, number = 82) # extract the body containing the reprex (code + output as markdown) issue[[1]][["body"]] %>% clipr::write_clip() # strip markdown formatting to revert to initial state reprex::reprex_invert() # then paste to console
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.