Learn R Programming

roxygen2 (version 3.1.0)

namespace_roclet: Roclet: make NAMESPACE.

Description

This roclet automates the production of a NAMESPACE file, see Writing R Extensions (http://cran.r-project.org/doc/manuals/R-exts.pdf) for details.

Usage

namespace_roclet()

Arguments

Tags

There are four tags for exporting objects from the package:
@export
Roxygen guesses the directive: export for functions, exportMethod for S4 methods, S3method for S3 methods, exportClass for S4 classes. This is the only directive you should need for documented function, the other directives are useful if you want to export (e.g.) methods but not document them.
@export f g ...
overrides auto-detection and produces multiple export directives: export(f), export(g) ...
@exportClass x
produces exportClasses(x) directive.
@exportMethod x
produces exportMethods(x) directive.
@S3method generic class
produces S3method(generic,class) directive
There are five tags for importing objects into the package:
@import package
produces import(package) directive to import all functions from the given package
@importFrom package functiona functionb ...
produces multiple importFrom(package, function) directives to import selected functions from a package.
@importClassesFrom package classa classb ...
produces multiple importClassesFrom(package, class) directives to import selected classes from a package.
@importMethodsFrom package methoda methodb ...
produces multiple importMethodsFrom(package, method) directives to import selected methods from a package.
@useDynLib package
produces a useDynLib(package) directive to import all compiled routines from the shared objects in the specified package
@useDynLib paackage routinea routineb
produces multiple useDynLib(package,routine) directions to import specified compiled routines from a package.
Only unique directives are saved to the NAMESPACE file, so you can repeat them as needed to maintain a close link between the functions where they are needed and the namespace file.

See Also

Other roclets: rd_roclet

Examples

Run this code
#' An example file, example.R, which imports
#' packages foo and bar
#' @import foo bar
NULL

#' An exportable function
#' @export
fun <- function() {}

roclet <- namespace_roclet()
## Not run: roc_proc(roclet, "example.R")
## Not run: roc_out(roclet, "example.R", ".")

Run the code above in your browser using DataLab