从 roxygen2 >3.0.0 开始,您只需要@export
:
#' A description of MyHappyFunction
#'
#' A details of MyHappyFunction
#'
#' @title MyHappyFunction: The my happy function
#' @param x numeric number
#' @param ... other arguments
#' @examples
#' a <- 1
#' class(a) <- "lm"
#' MyHappyFunction(a)
#' @export
MyHappyFunction <- function(x, ...){
UseMethod("MyHappyFunction")
}
#' @rdname MyHappyFunction
#' @export
MyHappyFunction.lm = function(x, ...) {
# do some magic
}
#' @rdname MyHappyFunction
#' @export
MyHappyFunction.default = function(x, ...) {
# do some magic
}
但由于您实际上并未记录方法,因此以下内容就足够了:
#' A description of MyHappyFunction
#'
#' A details of MyHappyFunction
#'
#' @title MyHappyFunction: The my happy function
#' @param x numeric number
#' @param ... other arguments
#' @examples
#' a <- 1
#' class(a) <- "lm"
#' MyHappyFunction(a)
#' @export
MyHappyFunction <- function(x, ...){
UseMethod("MyHappyFunction")
}
#' @export
MyHappyFunction.lm = function(x, ...) {
# do some magic
}
#' @export
MyHappyFunction.default = function(x, ...) {
# do some magic
}