Rainer M Krug
2011-Aug-22 16:43 UTC
[R] Reading DESCRIPTION files to create dependency diagram
Hi I want to create a dependence diagram of a subset of the packages on CRAN and would therefore like to read the DEACRIPTION files into a list. The list should be as follow for each package: - package name: list - Package: character - Version: character - Date: character - ... - Depends: character vector - Suggests: character vector - ... I downloaded all packages and extracted all DESCRIPTION, but I am struggling with the creation of the list (I tried using scan(what=list(), multi.line=TRUE) with different things in list()). Before I spend to much time on it, is there a function which could help me or has somebody done something similar (I assume the DESCRIPTION file ust be somewhere be read dueing install.packages()? Cheers, Rainer -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax (F): +33 - (0)9 58 10 27 44 Fax (D): +49 - (0)3 21 21 25 22 44 email: Rainer@krugs.de Skype: RMkrug [[alternative HTML version deleted]]
Uwe Ligges
2011-Aug-22 17:12 UTC
[R] Reading DESCRIPTION files to create dependency diagram
On 22.08.2011 18:43, Rainer M Krug wrote:> Hi > > I want to create a dependence diagram of a subset of the packages on CRAN > and would therefore like to read the DEACRIPTION files into a list. The list > should be as follow for each package: > > - package name: list > - Package: character > - Version: character > - Date: character > - ... > - Depends: character vector > - Suggests: character vector > - ...Some of these informations are collected in the CRAN repository's PACKAGES file. If those are not sufficient, you can also read separate DESCRIPTIONS files, of course. There is packageDescription() in utils for accessing installed packages' DESCRIPTION information or just use read.dcf() to read the DESCRIPTION files directly. Example: as.list(read.dcf(system.file("DESCRIPTION", package="tools"))[1,]) For the dependency diagram, see dependsOnPkgs() and .package_dependencies() (the latter internal) in package tools, as well as what these guys wrote: Theu?l, S., Ligges, U. and Hornik, K. (2011): Prospects and Challenges in R Package Development. Computational Statistics 26 (3), 395-404. Uwe Ligges> I downloaded all packages and extracted all DESCRIPTION, but I am struggling > with the creation of the list (I tried using scan(what=list(), > multi.line=TRUE) with different things in list()). Before I spend to much > time on it, is there a function which could help me or has somebody done > something similar (I assume the DESCRIPTION file ust be somewhere be read > dueing install.packages()? > > Cheers, > > Rainer > >