R/NewFunction.R

Defines functions NewFunction

Documented in NewFunction

NewFunction =
    function(FunctionName, args = NULL, NArgs = 0) {
      if (is.numeric(args[1])) {
        NArgs = args[1]
        args = NULL
      }
      if (is.null(args)) {
        args = rep("", NArgs)
      } else {
        NArgs = length(args)
      }
      Filename = paste0(FunctionName, ".R")
      cat(paste0(
              "#' @rdname ", FunctionName, "\n#' @title
\n#' @aliases ",
              FunctionName,
              "
\n#' @description
\n#' @details
\n#' @return
\n#' @seealso
\n#' @author ",
              getOption("BrailleR.Author"),
              "
\n#' @references
\n#' @examples
\n#' @export ", FunctionName,
              "

"), file = Filename, append = FALSE)
      if (NArgs > 0) {
        cat(paste("#' @param", args, "\n"), file = Filename, append = TRUE)
      }

      cat(paste0("\n", FunctionName, "= function(",
                 paste(args, collapse = ", "), "){

}
"), file = Filename,
          append = TRUE)
        .FileCreated(Filename, "in the current working directory.") 
      return(invisible(NULL))
    }

Try the BrailleR package in your browser

Any scripts or data that you put into this service are public.

BrailleR documentation built on July 26, 2023, 5:46 p.m.