简体   繁体   English

使R-package只加载其他软件包并导出所有功能

[英]Make R-package that just loads other packages and exports all functions

Is it possible to make an R-package that just exports all functions from other R-packages? 是否有可能制作一个R包,使其仅导出其他R包中的所有功能? Is there another way to have the functions in a package categorized and ordered accordingly in the manual, code files etc.? 是否有另一种方法可以在手册,代码文件等中相应地对软件包中的功能进行分类和排序?

Yes, you can have a package that is invoked just for its dependencies. 是的,您可以有一个仅出于其依赖关系而调用的程序包。 As a prominent example, the now-archived gregmisc package , which began as a huge collection of different functions, was eventually broken down into separate packages. 举一个著名的例子, 现在存档的gregmisc软件包最初是大量不同功能的集合)最终被分解为单独的软件包。 While gregmisc was still available on CRAN it contained no functions, just this startup function: 尽管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."
                        )
}

And then simply had dependencies on the new separated packages described in the DESCRIPTION file: 然后仅依赖于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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM