Created
June 13, 2013 22:53
-
-
Save gmonaie/5778107 to your computer and use it in GitHub Desktop.
R: dependsOnPkgsGraph
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tools) | |
library(foreach) | |
library(iterators) | |
library(rCharts) | |
library(slidify) | |
library(slidifyLibraries) | |
library(doParallel) | |
library(d3Network) | |
package <- grep("^package:", search(), value = TRUE) | |
keep <- sapply(package, function(x) x == "package:base" || | |
!is.null(attr(as.environment(x), "path"))) | |
package <- sub("^package:", "", package[keep]) | |
# packagedb = available.packages(contriburl="http://R-Forge.R-project.org") | |
# grab the package dependencies | |
# x = foreach(p=iter(package), .combine='c') %do% | |
# {package_dependencies(p, db=packagedb, recursive=TRUE)} | |
x = foreach(p=iter(package)) %do% {dependsOnPkgs(p, recursive=FALSE)} | |
names(x) = package | |
# x = lapply(x, function(x) if(is.null(x)){"NA"} else {x}) | |
# parse them into Source and Targets | |
Source = foreach(i=1:length(x), .combine='c') %do% {rep(names(x[i]),length(x[[i]]))} | |
Target = (foreach(i=1:length(x), .combine='c') %do%{x[[i]]}) | |
NetworkData <- data.frame(Source, Target) | |
# Load packages to download d3SimpleNetwork | |
library(digest) | |
library(devtools) | |
# Download d3SimpleNetwork | |
# source_gist("5734624") | |
d3SimpleNetwork(NetworkData, height = 800, width = 1280, file='myPackages.html') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Shows you your package dependencies using the d3SimpleNetwork package by Christopher Gandrud http://christophergandrud.github.io/d3Network/