KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Actual question How can I avoid that \dontrun{ in a separate file containing examples becomes \\dontrun{ in the respective Rd file after roxygenizing? I did find a workaround, but feel as if I'm maybe just missing something obvious, i.e. some setting of roxigenize() . Details I think I noticed a possible bug or, IMHO, at least an undesired behavior when processing examples with roxygen2 that are stored in a separate file (as opposed to stating it right within the actual roxygen code). The issue is that the line \dontrun{ in the respective example files becomes \\dontrun{ in the resulting Rd file after roxygenizing. Below you'll find an illustration of the behavior along with a simple workaround 1) Ensure directories dir.create("src", recursive=TRUE, showWarnings=FALSE) dir.create("package", recursive=TRUE, showWarnings=FALSE) # Ensure empty package directory subdirs <- list.files("package", full.names=TRUE) if (length(subdirs)) { sapply(subdirs, unlink, recursive=TRUE) } 2) Create example functions with two different ways of embedding examples foo1 <- function(x) {message("I'm foo #1"); return(TRUE)} roxy.1 <- c( "#' Title foo1()", "#'", "#' Description foo1().", "##' This line is commented out", "#'", "#' @param x Some R object that doesn't matter.", "#' @return \\code{TRUE}.", "#' @references \\url{http://www.something.com/}", "#' @author John Doe \\email{john.doe@@something.com}", "#' @seealso \\code{\\link{foo2}}", "#' @example inst/examples/foo1.R" ) ex.1 <- c( "\\dontrun{", "foo1()", "}" ) foo2 <- function(y) {message("I'm foo #2"); return(FALSE)} roxy.2 <- c( "#' Title foo2()", "#'",
Tags (comma-separated)
Save Edits
Cancel