<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/revoscaler-package-dependencies-with-graph-visualization/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://tomaztsql.wordpress.com/2017/03/15/revoscaler-package-dependencies-with-graph-visualization/"> R – TomazTsql</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p><a target="_blank" rel="nofollow" href="https://mran.microsoft.com/">MRAN</a> currently holds 7520 R Packages. We can see this with usage of following command (stipulating that you are using MRAN R version. ):</p>
<pre>library(tools)
df_ap &lt;- data.frame(available.packages())
head(df_ap)</pre>
<p><img sizes="(max-width: 747px) 100vw, 747px" data-image-description="" data-orig-file="https://i1.wp.com/tomaztsql.files.wordpress.com/2017/03/2017-03-13-19_38_02-rstudio.png?w=450&amp;ssl=1" data-orig-size="1495,246" data-image-title="2017-03-13 19_38_02-RStudio" class="wp-image-3899" data-comments-opened="1" data-recalc-dims="1" data-attachment-id="3899" data-permalink="https://tomaztsql.wordpress.com/2017/03/15/revoscaler-package-dependencies-with-graph-visualization/2017-03-13-19_38_02-rstudio/#main" alt="2017-03-13 19_38_02-RStudio" data-medium-file="https://i1.wp.com/tomaztsql.files.wordpress.com/2017/03/2017-03-13-19_38_02-rstudio.png?w=450&amp;ssl=1?w=300" data-large-file="https://i1.wp.com/tomaztsql.files.wordpress.com/2017/03/2017-03-13-19_38_02-rstudio.png?w=450&amp;ssl=1?w=700" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" src="https://i1.wp.com/tomaztsql.files.wordpress.com/2017/03/2017-03-13-19_38_02-rstudio.png?w=450&ssl=1"></p>
<p>With importing package <a target="_blank" rel="nofollow" href="https://stat.ethz.ch/R-manual/R-devel/library/tools/html/00Index.html">tools</a>, we get many useful functions to find additional information on packages.</p>
<p>Function package.dependencies() parses and check dependencies of a package in current environment. Function <a target="_blank" rel="nofollow" href="https://stat.ethz.ch/R-manual/R-devel/library/tools/html/package_dependencies.html">package_dependencies()</a>  (with underscore and not dot) will find all dependent and reverse dependent packages.</p>
<p>With following code I can extract the packages and their dependencies (this will perform a data normalization):</p>
<pre>net &lt;- data.frame(df_ap[,c(1,4)])
library(dplyr)
netN &lt;- net %>% 
        mutate(Depends = strsplit(as.character(Depends), &quot;,&quot;)) %>% 
        unnest(Depends)
netN</pre>
<p>And the result is:</p>
<pre>Source: local data frame [14,820 x 2]

   Package       Depends
    (fctr)         (chr)
1       A3 R (>= 2.15.0)
2       A3        xtable
3       A3       pbapply
4   abbyyR  R (>= 3.2.0)
5      abc   R (>= 2.10)
6      abc      abc.data
7      abc          nnet
8      abc      quantreg
9      abc          MASS
10     abc        locfit
..     ...           ...</pre>
<p>Presented way needs to be further cleaned and prepared.</p>
<p>Once you have data normalized, we can use any of the network packages for visualizing the data. With use of <a target="_blank" rel="nofollow" href="http://igraph.org/r/">igraph</a> package, I created visual presentation of the RevoScaleR package; dependencies and imported packages.</p>
<p>With the code I filter out the RevoScaleR package and create visual:</p>
<pre>library(igraph)
netN_g &lt;- graph.data.frame(edges[edges$src %in% c('RevoScaleR', deptree), ])
plot(netN_g)</pre>
<p><img sizes="(max-width: 700px) 100vw, 700px" data-image-description="" data-orig-file="https://i0.wp.com/tomaztsql.files.wordpress.com/2017/03/2017-03-15-17_01_14-plot-zoom.png?w=456&amp;ssl=1" data-orig-size="777,732" data-image-title="2017-03-15 17_01_14-Plot Zoom" data-comments-opened="1" class="wp-image-3918" data-recalc-dims="1" data-attachment-id="3918" data-permalink="https://tomaztsql.wordpress.com/2017/03/15/revoscaler-package-dependencies-with-graph-visualization/2017-03-15-17_01_14-plot-zoom/#main" alt="2017-03-15 17_01_14-Plot Zoom" data-medium-file="https://i0.wp.com/tomaztsql.files.wordpress.com/2017/03/2017-03-15-17_01_14-plot-zoom.png?w=456&amp;ssl=1?w=300" data-large-file="https://i0.wp.com/tomaztsql.files.wordpress.com/2017/03/2017-03-15-17_01_14-plot-zoom.png?w=456&amp;ssl=1?w=700" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" src="https://i0.wp.com/tomaztsql.files.wordpress.com/2017/03/2017-03-15-17_01_14-plot-zoom.png?w=456&ssl=1"></p>
<p> </p>
<p>Happy Ring!</p>
<p> </p>
<p> </p>
<p> <a target="_blank" rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tomaztsql.wordpress.com/3890/"><img alt="" src="http://feeds.wordpress.com/1.0/comments/tomaztsql.wordpress.com/3890/" border="0"></a> <img alt="" src="https://i1.wp.com/pixel.wp.com/b.gif?resize=1%2C1&ssl=1" border="0" data-recalc-dims="1"></p>
<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://tomaztsql.wordpress.com/2017/03/15/revoscaler-package-dependencies-with-graph-visualization/"> R – TomazTsql</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/search/data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/search/map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/search/animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/search/sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/search/SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/search/git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/search/hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/search/PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/search/time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/search/trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/GjKu-yDN03Y"></a></div>