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.

Posting reprexes

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") )

Getting and running reprexes

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


emilyriederer/projmgr documentation built on Jan. 26, 2024, 3:09 a.m.