簡體   English   中英

使R-package只加載其他軟件包並導出所有功能

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

是否有可能制作一個R包,使其僅導出其他R包中的所有功能? 是否有另一種方法可以在手冊,代碼文件等中相應地對軟件包中的功能進行分類和排序?

是的,您可以有一個僅出於其依賴關系而調用的程序包。 舉一個著名的例子, 現在存檔的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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM