Learn R Programming

roxygen2 (version 7.2.1)

tags-namespace: Tags for managing the NAMESPACE

Description

Learn full the details in in vignette('namespace').

Key tags:

  • @export: Export this function, method, generic, or class so it's available outside of the package.

  • @exportS3Method pkg::generic: Export an S3 method. Only needed when the method is for a generic from a suggested package.

  • @importFrom {package} {function}: Import specific functions from a package.

  • @useDynLib {package}: Import compiled code from another package.

Other less frequently used tags:

  • @evalNamespace {r-code}: Evaluate arbitrary code in the package namespace and insert the results into the NAMESPACE. Should return a character vector of directives.

  • @exportClass {class}: Export an S4 class. For expert use only; in most cases you should use @export so roxygen2 can automatically generate the correct directive.

  • @exportMethod {generic}: Export S4 methods. For expert use only; in most cases you should use @export so roxygen2 can automatically generate the correct directive.

  • @exportPattern {pattern}: Export all objects matching a regular expression.

  • @import {package}: Import all functions from a package. Use with extreme care.

  • @importClassesFrom {package} {class}: Import S4 classes from another package.

  • @importMethodsFrom {package} {generic}: Import S4 methods from a package.

  • @rawNamespace {namespace directives}: Insert literal text directly into the NAMESPACE.

Usage

#' @evalNamespace {r-code}
#' @export
#' @exportClass {class}
#' @exportMethod {generic}
#' @exportPattern {pattern}
#' @exportS3Method pkg::generic
#' @import {package}
#' @importClassesFrom {package} {class}
#' @importFrom {package} {function}
#' @importMethodsFrom {package} {generic}
#' @rawNamespace {namespace directives}
#' @useDynLib {package}

Arguments