-
Notifications
You must be signed in to change notification settings - Fork 289
Closed
Description
Starting a new package, I wanted to use templates for parameters used in multiple functions. I forgot how this was supposed to work with the @template
syntax (what the directory needed to be, whether the templates were .R
or .Rd
, etc.) and was hoping usethis would do things for me. I wrote the below quickly to remind future me, but i think it would be a nice feature of usethis. I'll create a PR now as well, though I'm sure your team will write a better function if you add this functionality.
#' Create a template for package documentation
#'
#' @param templateName Character, name of template and file
#'
#' @return This function creates a `.R` file in the directory "man-roxygen". If
#' that directory does not already exist in your package, it will create it.
#' The function opens the new (blank) file in your editor.
#'
#' @seealso \code{\link{file.edit}}
#' @export
#'
#' @examples
use_RdTemplate <- function(templateName){
if(!dir.exists("man-roxygen")){
dir.create("man-roxygen")
}
pth <- paste0("man-roxygen/", templateName, ".R")
file.create(pth)
file.edit(pth)
}
Metadata
Metadata
Assignees
Labels
No labels