Try @examples (with an 's'): #' @examples #' my R code #' my R code I'm not sure if placing a relative path (tests/foo.R) would work...try placing the actual code in the documentation chunk.