2015-04-04 102 views
0

是否有可能制作一个仅从其他R软件包导出所有功能的R软件包?是否有另一种方式让软件包中的功能在手册,代码文件等中进行了相应的分类和排序?制作只装载其他软件包并导出所有功能的R软件包

+0

不是按照字母顺序排列等?你可以编写一个函数来检查软件包是否安装,如果没有安装,并把它放在你自己的软件包中。会不会只有一点点矫枉过正? – rawr 2015-04-04 20:34:23

+0

如果对于可以按组分类的不同任务有很多功能,字母顺序几乎是无用的,除非您已经知道应该如何使用这些功能并且只是忘记了一些小的细节(并记住它们的名字) 。而且我也不认为将所有代码放在一个R文件夹中是非常有用的,如果你想找到它的话。我真的希望可以将代码文件放在子文件夹中,并据此生成相应的手册。加载所有属于一起的软件包的软件包似乎是目前可能的最佳解决方案。 – tover 2015-04-05 00:25:23

回答

1

是的,您可以拥有一个仅针对其依赖关系调用的包。作为一个突出的例子,now-archived gregmisc package开始作为一个巨大的不同功能集合,最终被分解成单独的包。虽然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." 
         ) 
} 

,然后在说明文件中描述的新的分离的包根本就依赖:

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 <[email protected]> 
License: GPL-2 
Packaged: 2013-06-28 21:48:38 UTC; warnes 
NeedsCompilation: no 
Repository: CRAN 
Date/Publication: 2013-06-29 00:15:57 
+0

非常感谢!完美的作品! – tover 2015-04-05 00:16:15