Last active
December 11, 2015 21:58
-
-
Save geophtwombly/4666066 to your computer and use it in GitHub Desktop.
This file contains 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
for( file in list.files("./R", full.names = TRUE)) { | |
doc <- scan( what=character(), sep="\n", file, blank.lines.skip = FALSE)) | |
returns <- which(!grepl("returnItem", doc) & grepl("@return", doc)) | |
if(length(returns) > 0){ | |
doc[returns] <- gsub("##' @return", paste("##' @export\n##' @return"), doc[returns]) | |
doc <- paste(doc, collapse="\n") | |
cat(doc, file = file) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Slightly cleaner, keeps contents of
@return
:Although ideally, we would want to ensure we don't already have an
@export
statement somewhere in the block, and that's a more difficult problem...