When developing new R functions, I continually reload the function ("cmd + enter"), but then I want to run the examples in @examples in the function's roxygen2 docs. For example:
#' My new function
#'
#' @examples
#' my_function()
my_function <- function(){
2 + 2
}
I can load my function easily via "cmd + enter" (cursor at the first or last line of the function), which moves my cursor to the end of the function.
I then want to run my_function()
from @examples, but I have to move my cursor up to @examples, which arduous for long functions.
I can't find the keyboard shortcut for auto-running the code in @examples. Any help would be appreciated!