neighborhood_graph: neighborhood_graph

Description Usage Arguments Value Author(s) See Also Examples

Description

Obtain a network or igraph graph object of dependencies and reverse dependencies of packages at a given depth of recursion

Usage

1
2
3
4
5
neighborhood_graph(packages, level = 1L, type = "igraph",
  relation = c("Depends", "Imports", "LinkingTo", "Suggests",
  "Enhances"), strict = FALSE, interconnect = TRUE,
  ignore = c("datasets", "utils", "grDevices", "graphics", "stats",
  "methods"))

Arguments

packages

(non-empty character vector) Package names

level

(positive integer, Default: 1L) Depth of recursive dependency

type

(string, Default: "igraph") Graph object type. Either "network" or "igraph"

relation

(character vector) Types of graph edges. Must be a subset of c("Depends", "Imports", "LinkingTo", "Suggests", "Enhances")

strict

(logical, Default: TRUE) Whether to consider all packages (alternately only 'relation' specific packages) when computing dependencies for the next level

interconnect

(flag, Default: TRUE) Whether to capture dependency among packages (of a given level) of the next level (See examples)

ignore

package names to ignore

Value

A network or igraph graph object

Author(s)

Srikanth KS

See Also

get_neighborhood, make_neighborhood_graph

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# explore first level dependencies
pkggraph::init(local = TRUE)
pkggraph::neighborhood_graph("caret")

# explore second level dependencies of class network
pkggraph::neighborhood_graph("caret", level = 2, type = "network")

# get 'imports' specific neighborhood of 'mlr' package with strict = TRUE
neighborhood_graph("mlr"
                   , level        = 2
                   , strict       = TRUE
                   , interconnect = FALSE
                   , relation     = "Imports")

# get 'imports' specific neighborhood of 'mlr' package with strict = FALSE
neighborhood_graph("mlr"
                   , level        = 2
                   , strict       = FALSE
                   , interconnect = FALSE
                   , relation     = "Imports")

Example output

Loading required package: ggnetwork
Loading required package: ggplot2
Loading required package: data.table
Using 'local' data ...
To fetch data from CRAN over internet, run:`pkggraph::init(local = FALSE)`
Done!
$graph_object
IGRAPH e36a979 DN-- 119 576 -- 
+ attr: name (v/c), relation (e/c)
+ edges from e36a979 (vertex names):
 [1] adabag         ->mlbench    adabag         ->caret     
 [3] AntAngioCOOL   ->caret      biomod2        ->ggplot2   
 [5] caret          ->lattice    caret          ->ggplot2   
 [7] classifierplots->ggplot2    classifierplots->data.table
 [9] conformal      ->caret      conformal      ->ggplot2   
[11] conformal      ->e1071      Cubist         ->lattice   
[13] doParallel     ->foreach    doSNOW         ->foreach   
[15] dtree          ->party      dtree          ->caret     
+ ... omitted several edges

attr(,"class")
[1] "pkggraph"
$graph_object
 Network attributes:
  vertices = 832 
  directed = TRUE 
  hyper = FALSE 
  loops = FALSE 
  multiple = FALSE 
  bipartite = FALSE 
  total edges= 5202 
    missing edges= 0 
    non-missing edges= 5202 

 Vertex attribute names: 
    vertex.names 

 Edge attribute names not shown 

attr(,"class")
[1] "pkggraph"
$graph_object
IGRAPH 6e3da7d DN-- 24 27 -- 
+ attr: name (v/c), relation (e/c)
+ edges from 6e3da7d (vertex names):
 [1] BBmisc     ->checkmate   checkmate  ->backports   ggplot2    ->digest     
 [4] ggplot2    ->grid        ggplot2    ->gtable      ggplot2    ->MASS       
 [7] ggplot2    ->plyr        ggplot2    ->reshape2    ggplot2    ->scales     
[10] ggplot2    ->tibble      ggplot2    ->lazyeval    mlr        ->BBmisc     
[13] mlr        ->backports   mlr        ->ggplot2     mlr        ->stringi    
[16] mlr        ->checkmate   mlr        ->data.table  mlr        ->parallelMap
[19] mlr        ->survival    parallelMap->BBmisc      parallelMap->checkmate  
[22] parallelMap->parallel    stringi    ->tools       survival   ->Matrix     
+ ... omitted several edges

attr(,"class")
[1] "pkggraph"
$graph_object
IGRAPH d75d2dd DN-- 172 225 -- 
+ attr: name (v/c), relation (e/c)
+ edges from d75d2dd (vertex names):
 [1] batchtools->backports    batchtools->base64url    batchtools->brew        
 [4] batchtools->checkmate    batchtools->digest       batchtools->parallel    
 [7] batchtools->progress     batchtools->R6           batchtools->rappdirs    
[10] batchtools->stringi      batchtools->withr        BBmisc    ->checkmate   
[13] bst       ->rpart        bst       ->foreach      bst       ->doParallel  
[16] C50       ->partykit     caret     ->car          caret     ->foreach     
[19] caret     ->plyr         caret     ->ModelMetrics caret     ->nlme        
[22] caret     ->reshape2     caret     ->stats4       checkmate ->backports   
+ ... omitted several edges

attr(,"class")
[1] "pkggraph"

pkggraph documentation built on May 2, 2019, 2:08 a.m.