Created
March 6, 2016 16:31
-
-
Save hrbrmstr/80393a8c88c84b84f3ba to your computer and use it in GitHub Desktop.
hack-ish way to get all the code examples from your package
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fil <- list.files("man", full.names=TRUE) | |
cat(sapply(fil, function(x) { | |
rd <- tools::parse_Rd(x) | |
ex <- rd[devtools:::rd_tags(rd) == "examples"] | |
trimws(paste0(devtools:::process_ex(ex, run=FALSE), sep="", collapse="\n")) | |
}, USE.NAMES=FALSE)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In summary, this script is designed to extract code examples from R documentation files and print them to the console, making it easier to view and work with the example code provided in the documentation. It appears to be a utility for developers working with R packages or functions.