[R] Reading DESCRIPTION files to create dependency diagram

Uwe Ligges ligges at statistik.tu-dortmund.de
Mon Aug 22 19:12:16 CEST 2011



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
>
>



More information about the R-help mailing list