是否可以制作一个仅从其他 R 包中导出所有功能的 R 包?是否有另一种方法可以在手册、代码文件等中对包中的功能进行相应分类和排序?
问问题
91 次
1 回答
1
是的,您可以拥有一个仅为其依赖项调用的包。作为一个突出的例子,现在存档的gregmisc包,最初是一个巨大的不同功能的集合,最终被分解成单独的包。虽然 gregmisc 在 CRAN 上仍然可用,但它不包含任何功能,只有这个启动功能:
.onAttach <- function(libname, pkgname)
{
packageStartupMessage(
"All functionality of the `gregmisc' package has been moved",
"into the four 'g' packages: gdata, gtools, gmodels, and gplots. ",
"This package is retained to make it easy to install and load",
"the full set. Please consider loading these packages directly."
)
}
然后简单地依赖于DESCRIPTION文件中描述的新分离包:
Package: gregmisc
Title: Greg's Miscellaneous Functions
Description: Description: The former gregmisc bundle is a repository
for a variety of useful functions. The gregmisc package has
been split into a set of more focused packages: gdata, gmodels,
gplots, gtools. The purpose of this 'new' gregmisc is to
provide an easy way to access the original combined
functionality. To this end, it simply depends on all of the
new packages so that these will installed/loaded when this
package is installed/loaded.
Depends: gdata, gmodels, gplots, gtools
Version: 2.1.5
Author: Gregory R. Warnes.
Maintainer: Gregory R. Warnes <greg@warnes.net>
License: GPL-2
Packaged: 2013-06-28 21:48:38 UTC; warnes
NeedsCompilation: no
Repository: CRAN
Date/Publication: 2013-06-29 00:15:57
于 2015-04-04T20:43:42.017 回答