Heaviness from parent packages

heaviness(x, rel = FALSE, a = 10, only_strong_dep = FALSE)

Arguments

x

An object returned by pkgndep.

rel

Whether to return the absolute measure or the relative measure.

a

A constant added for calculating the relative measure.

only_strong_dep

Whether to only return the heaviness for strong parents.

Details

The heaviness from a parent package is calculated as follows: If package B is in the Depends/Imports/LinkingTo fields of package A, which means, package B is necessary for package A, denote v1 as the total numbers of packages required for package A, and v2 as the total number of required packages if moving package B to Suggests (which means, now B is not necessary for A). The absolute measure is simply v1 - v2 and relative measure is (v1 + a)/(v2 + a).

In the second scenario, if B is in the Suggests/Enhances fields of package A, now v2 is the total number of required packages if moving B to Imports, the absolute measure is v2 - v1 and relative measure is (v2 + a)/(v1 + a).

Value

A numeric vector.

Examples

x = readRDS(system.file("extdata", "ComplexHeatmap_dep.rds", package = "pkgndep"))
heaviness(x)
#>       grDevices        graphics            grid           stats         methods 
#>               0               0               0               0               0 
#>    RColorBrewer             png     matrixStats          digest         foreach 
#>               1               1               1               1               0 
#>      colorspace   GlobalOptions            clue      doParallel      GetoptLong 
#>               0               0               2               4               3 
#>         IRanges        circlize        dendsort            jpeg            tiff 
#>               4               2               1               1               1 
#>     fastcluster           Cairo    gridGraphics            glue        markdown 
#>               1               1               1               1               3 
#>        grImport          gplots       grImport2           knitr   GenomicRanges 
#>               2               5               4               9               7 
#>        pheatmap        gridtext       rmarkdown        testthat EnrichedHeatmap 
#>              11              14              17              29              12 
#>      dendextend 
#>              32 
heaviness(x, rel = TRUE)
#>       grDevices        graphics            grid           stats         methods 
#>        1.000000        1.000000        1.000000        1.000000        1.000000 
#>    RColorBrewer             png     matrixStats          digest         foreach 
#>        1.025641        1.025641        1.025641        1.025641        1.000000 
#>      colorspace   GlobalOptions            clue      doParallel      GetoptLong 
#>        1.000000        1.000000        1.052632        1.111111        1.081081 
#>         IRanges        circlize        dendsort            jpeg            tiff 
#>        1.111111        1.052632        1.025000        1.025000        1.025000 
#>     fastcluster           Cairo    gridGraphics            glue        markdown 
#>        1.025000        1.025000        1.025000        1.025000        1.075000 
#>        grImport          gplots       grImport2           knitr   GenomicRanges 
#>        1.050000        1.125000        1.100000        1.225000        1.175000 
#>        pheatmap        gridtext       rmarkdown        testthat EnrichedHeatmap 
#>        1.275000        1.350000        1.425000        1.725000        1.300000 
#>      dendextend 
#>        1.800000