r - roxygen2 how to not run example file -


i aware of how have roxygen not run example when code directly in roxygen comments. however, example may verbose or want examples compiled in examples directory. in case @example file_path works fine can't figure out how have roxygen not run (i.e. \dontrun) example file.

this admitted similar this question comments show problem not answered.

test.r

# not work #' @title test_fun #' @example \dontrun{examples/test_example.r} test <- function(){     print("hello") }  # #' @title test #' @examples  #' \dontrun{ #' test() #' } test <- function(){     print("hello") } 

test_example.r

test() 

how can former approach work?

it seems i'm able accomplish using roxygen2-style comments \dontrun{} block in example file. gets around limitation in michal's answer.

create example file looks this:

#' \dontrun{ test() #' } 

more reliably, can wrap example in if(interactive()) {} block, won't run during checks allows manually run through example.


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -