Learn R Programming

mvbutils (version 1.1.1)

make.NAMESPACE: Auto-create a NAMESPACE file

Description

Called by formalize.package for would-be packages that have an existing NAMESPACE file and that have been informally documented using flatdoc. It tries to work out which packages should be imported, which functions are meant to be exported, and which should be registered as S3 methods.

Usage

make.NAMESPACE( pos=1, path=attr( pos.to.env( pos), "path"))

Arguments

pos
character or numeric position on search path
path
directory where proto-package lives

Details

Normally, formalize.package will call make.NAMESPACE for you if necessary. If make.NAMESPACE is applied to proto-package "mypack", then it will produce a file called NAMESPACE in the "mypack/mypack" directory. The NAMESPACE file will consist of (maybe) a call to import, (definitely) a call to export with all the function names in quotes, and (maybe) a series of calls to S3Method. There is no attempt to handle S4 methods. The imported packages are those listed in the "Depends:" field of the DESCRIPTION file. The exported functions are all those in find.documented(doctype="any"), plus any functions that have a non-NULL export.me attribute. The attribute mechanism is useful for a function such as evaluator in the debug package, which has to be exported but should never be used directly and therefore doesn't need explicit documentation. formalize.package will incorporate any undocumented export.me functions in the "mypack-internal.Rd" file, so that RCMD CHECK will be happy. The S3 methods are all the functions whose names start "generic.", where "generic" is any element of the character vector .knownS3Generics in package:base-- except any functions with a non-NULL export.me attribute. You can use the attribute mechanism to prevent "methodization" of functions that look like methods but aren't really, such as as.data.frame.I in the mvbutils package. If you have defined new S3 generics and want to make sure that appropriate methods are exported in S3Method statements rather than export, you must ensure that the generic name has been added to .knownS3Generics.

See Also

formalize.package, flatdoc