├── .gitignore ├── DESCRIPTION ├── NAMESPACE ├── R ├── DepInterPackages.R ├── LinkAll.R ├── Sourcescript.R └── VisGraphAuto.R ├── README.md ├── inst ├── HTML │ └── temphelp.html ├── Shiny │ ├── SERVER.R │ ├── UI.R │ ├── global.R │ ├── temp.html │ └── www │ │ └── style.css └── Test.R └── man ├── Pck.load.Rd ├── Pck.load.to.vis.Rd ├── VisFunsmatrice.Rd ├── add.html.help.Rd ├── allDepFunction.Rd ├── allFunctionEnv.Rd ├── data.graph.script.Rd ├── envirDependencies.Rd ├── funDependencies.Rd ├── launch.app.Rd ├── linksForAll.Rd ├── linksForOne.Rd ├── mastersSlaves.Rd ├── plot.dependenciesGraphs.Rd └── prepareToVis.Rd /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .RData 4 | .Rproj -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: DependenciesGraphs 2 | Type: Package 3 | Title: Dependencies visualization between functions and environments 4 | Version: 0.3 5 | Date: 2016-05-14 6 | Author: Titouan Robert 7 | Maintainer: Titouan Robert 8 | Description: Dependencies visualization between functions and environments 9 | License: Free 10 | LazyData: TRUE 11 | Depends: visNetwork(>= 0.2.1),shinydashboard, XML 12 | Imports: mvbutils, rlist, tools 13 | RoxygenNote: 6.0.1 14 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | S3method(plot,dependenciesGraphs) 4 | export(Pck.load) 5 | export(Pck.load.to.vis) 6 | export(VisFunsmatrice) 7 | export(add.html.help) 8 | export(allDepFunction) 9 | export(allFunctionEnv) 10 | export(data.graph.script) 11 | export(envirDependencies) 12 | export(funDependencies) 13 | export(launch.app) 14 | export(linksForAll) 15 | export(linksForOne) 16 | export(mastersSlaves) 17 | export(prepareToVis) 18 | import(rlist) 19 | import(tools) 20 | importFrom(mvbutils,foodweb) 21 | -------------------------------------------------------------------------------- /R/DepInterPackages.R: -------------------------------------------------------------------------------- 1 | cleanExtract <- function(x) { 2 | temp <- gsub(" ", "", unlist(strsplit(x, "\\("))) 3 | supr <- grep(")", temp) 4 | if (length(supr) > 0) { 5 | temp <- temp[-supr] 6 | } 7 | temp <- gsub("\n", "", temp) 8 | temp <- gsub("^R$", "", temp) 9 | if (length(-which(nchar(temp) == 0)) > 0) { 10 | temp <- temp[-which(nchar(temp) == 0)] 11 | } 12 | if (length(temp) == 0 | is.na(temp)[1]) { 13 | temp = NULL 14 | } 15 | temp 16 | } 17 | 18 | #' @import rlist 19 | CleanList <- function(Tree.fun, extractName) { 20 | Tree.fun <- rlist::list.clean(Tree.fun) 21 | 22 | current.warn.option <- options("warn")$warn 23 | options(warn = -1) 24 | 25 | Tree.fun <- rlist::list.rbind(Tree.fun) 26 | 27 | row.nam <- rownames(Tree.fun) 28 | 29 | 30 | Tree.fun <- cbind(as.vector(Tree.fun), row.nam) 31 | 32 | options(warn = current.warn.option) 33 | 34 | Tree.fun <- unique(Tree.fun) 35 | 36 | Tree.fun <- data.frame(Tree.fun) 37 | names(Tree.fun) <- c("from", "to") 38 | Tree.fun$group <- extractName 39 | colnames(installed.packages()) 40 | Tree.fun 41 | 42 | } 43 | 44 | extraxtToList <- function(extractName) { 45 | x <- installed.packages()[, extractName] 46 | x <- strsplit(x, ",") 47 | Tree.fun <- lapply(x, cleanExtract) 48 | CleanList(Tree.fun, extractName) 49 | } 50 | 51 | #' Given dependencies between all install packages 52 | #' 53 | #' @return List of dependencies 54 | #' 55 | #' @export 56 | Pck.load <- function() { 57 | imp <- extraxtToList("Imports") 58 | sug <- extraxtToList("Suggests") 59 | lin <- extraxtToList("LinkingTo") 60 | dep <- extraxtToList("Depends") 61 | Tree.fun <- rbind(imp, sug, lin, dep) 62 | return(Tree.fun) 63 | } 64 | 65 | 66 | #' Given dependencies between all install packages 67 | #' 68 | #' @param Packages : Names of packages to includes to extract 69 | #' @param color.table : Name of color to use 70 | #' @return List to graph 71 | #' 72 | #' @export 73 | Pck.load.to.vis <- function(Packages = "All", color.table = c("#0B0B3B", "#0404B4", "#5858FA", "#A9A9F5")) { 74 | link <- Pck.load() 75 | 76 | if (Packages[1] == "All") { 77 | packages.view <- installed.packages()[, 1] 78 | } else { 79 | packages.view <- c(Packages, as.character(link[which(link[, 1] %in% Packages), 2]), as.character(link[which(link[, 2] %in% 80 | Packages), 1])) 81 | } 82 | 83 | visdata <- prepareToVis(link, unique(packages.view)) 84 | 85 | names(visdata$fromto)[3] <- "title" 86 | visdata$fromto$title <- paste0("

", visdata$fromto$title, "

") 87 | visdata$fromto$color <- as.numeric(as.factor(visdata$fromto$title)) 88 | 89 | for (i in 1:length(unique(visdata$fromto$color))) { 90 | visdata$fromto$color[which(as.character(visdata$fromto$color) == as.character(i))] <- color.table[i] 91 | } 92 | 93 | class(visdata) <- "dependenciesGraphs" 94 | return(visdata) 95 | } 96 | 97 | 98 | 99 | #' Given html help for a function 100 | #' 101 | #' @param package : Names of package to extract help 102 | #' @param func : Name of function to extract help 103 | #' @param tempsave : Tempory file to save help 104 | #' 105 | #' @export 106 | #' 107 | #' @import tools 108 | 109 | add.html.help <- function(package, func, tempsave = paste0(getwd(), "/temp.html")) { 110 | pkgRdDB = tools:::fetchRdDB(file.path(find.package(package), "help", package)) 111 | topics = names(pkgRdDB) 112 | rdfunc <- pkgRdDB[[func]] 113 | tools::Rd2HTML(pkgRdDB[[func]], out = tempsave) 114 | } 115 | 116 | -------------------------------------------------------------------------------- /R/LinkAll.R: -------------------------------------------------------------------------------- 1 | #' For a function, give all dependencies 2 | #' @param envir : environments where the function should search dependencies. 3 | #' @param name.function : function name (character) 4 | #' 5 | #' @return object of class dependenciesGraphs 6 | #' @importFrom mvbutils foodweb 7 | #' 8 | #' @export 9 | allDepFunction <- function(envir, name.functions) { 10 | envir <- paste0("package:", envir) 11 | toutfonc <- linksForOne(envir, name.functions) 12 | 13 | link <- toutfonc 14 | functions.list <- unique(as.character(unlist(c(toutfonc)))) 15 | 16 | Visdata <- list() 17 | 18 | Nomfun <- functions.list 19 | Nomfun <- data.frame(cbind(id = 1:length(Nomfun), label = Nomfun)) 20 | 21 | # func.link <- sort(unique(c(as.character(link[, 1]), as.character(link[, 2])))) 22 | # func.nom <- sort(unique(as.character(Nomfun[, 2]))) 23 | 24 | if (!is.null(link)) { 25 | fromto <- matrix(0, ncol = dim(link)[2], nrow = dim(link)[1]) 26 | if (length(fromto) > 0) { 27 | for (i in 1:dim(link)[1]) { 28 | fromto[i, 1] <- which(as.character(link[i, 2]) == Nomfun[, 2]) 29 | fromto[i, 2] <- which(as.character(link[i, 1]) == Nomfun[, 2]) 30 | if (dim(link)[2] > 2) { 31 | fromto[i, 3:length(link[i, ])] <- link[i, 3:length(link[i, ])] 32 | } 33 | } 34 | } 35 | } else { 36 | fromto <- cbind(0, 0) 37 | } 38 | fromto <- data.frame(fromto) 39 | names(fromto) <- c("from", "to") 40 | Visdata$Nomfun <- Nomfun 41 | Visdata$fromto <- fromto 42 | class(Visdata) <- "dependenciesGraphs" 43 | return(Visdata) 44 | } 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /R/Sourcescript.R: -------------------------------------------------------------------------------- 1 | 2 | 3 | package.load <- function(path) { 4 | script <- read.table(path, sep = "\n") 5 | 6 | row.charg.pck <- as.character(script$V1[c(which(regexpr("library", script$V1) != -1), which(regexpr("require", script$V1) != 7 | -1))]) 8 | row.charg.pck <- unlist(strsplit(row.charg.pck, ";")) 9 | row.charg.pck <- as.character(row.charg.pck[c(which(regexpr("library", row.charg.pck) != -1), which(regexpr("require", row.charg.pck) != 10 | -1))]) 11 | row.charg.pck <- unlist(strsplit(row.charg.pck, ",")) 12 | row.charg.pck <- as.character(row.charg.pck[c(which(regexpr("library", row.charg.pck) != -1), which(regexpr("require", row.charg.pck) != 13 | -1))]) 14 | 15 | row.charg.pck <- unlist(strsplit(row.charg.pck, "[(]")) 16 | row.charg.pck <- unlist(strsplit(row.charg.pck, "[)]")) 17 | 18 | 19 | row.charg.pck <- gsub(" ", "", x = row.charg.pck) 20 | row.charg.pck <- gsub("\t", "", x = row.charg.pck) 21 | row.charg.pck <- row.charg.pck[-which(row.charg.pck %in% (c("require", "library")))] 22 | row.charg.pck <- unique(row.charg.pck) 23 | return(row.charg.pck) 24 | } 25 | 26 | 27 | script.like.fun <- function(path, path.temp) { 28 | script <- read.table(path, sep = "\n", quote = "")$V1 29 | scriptfun <- rep("", length(script) + 2) 30 | scriptfun[1] <- "glob <- function(){" 31 | scriptfun[2:(length(script) + 1)] = as.character(script) 32 | scriptfun[length(script) + 2] = "}" 33 | write.table(as.factor(scriptfun), path.temp, row.names = FALSE, col.names = FALSE, quote = FALSE) 34 | } 35 | 36 | 37 | 38 | 39 | 40 | #' Dependencies for scripts 41 | #' 42 | #' @param path : path of R Script 43 | #' 44 | #' @examples 45 | #' 46 | #' dep <- data.graph.script('MyRScrpt.R') 47 | #' plot(dep) 48 | #' 49 | #' @export 50 | data.graph.script <- function(path) { 51 | 52 | e <- new.env() 53 | path.temp = paste0(getwd(), "/temp.file.dep.graph.R") 54 | source(path, local = e) 55 | script.like.fun(path, path.temp) 56 | source(path.temp, local = e) 57 | fcte <- allFunctionEnv(e) 58 | file.remove(path.temp) 59 | 60 | 61 | ls(e) 62 | all.pck <- package.load(path) 63 | dep <- list() 64 | for (j in 1:length(all.pck)) { 65 | 66 | all.obj <- ls.str(paste0("package:", all.pck[j]), mode = "function") 67 | 68 | for (i in 1:length(all.obj)) { 69 | assign(all.obj[i], get(all.obj[i], envir = as.environment(paste0("package:", all.pck[j]))), envir = e) 70 | } 71 | 72 | } 73 | 74 | dep <- funDependencies(e, fcte) 75 | dep$fromto <- unique(dep$fromto) 76 | 77 | 78 | dep$Nomfun$group <- "YourScript" 79 | for (j in 1:length(all.pck)) { 80 | 81 | all.obj <- ls.str(paste0("package:", all.pck[j]), mode = "function") 82 | 83 | all.obj <- as.character(all.obj) 84 | dep$Nomfun$group[which(dep$Nomfun$label %in% all.obj)] = all.pck[j] 85 | 86 | } 87 | 88 | dep$Nomfun$group[which(dep$Nomfun$label == "glob")] = "script" 89 | 90 | rm(e) 91 | class(dep) <- "dependenciesGraphs" 92 | return(dep) 93 | 94 | } 95 | 96 | 97 | 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /R/VisGraphAuto.R: -------------------------------------------------------------------------------- 1 | #' Given a environment, can be a package, returns a vector of included functions in this environment 2 | #' @param envir : Environment, try 'search()' to obtain a list of loaded environments 3 | #' @return Names of included functions in this environment. 4 | #' 5 | #' @export 6 | allFunctionEnv <- function(name, envir) { 7 | functions.name <- as.vector(ls.str(getNamespace(unlist(strsplit(name, ":"))[2]), mode = "function")) 8 | return(functions.name) 9 | } 10 | 11 | #' Given a matrix, returns a dataframe which two columns 'master'and 'slave' 12 | #' @param Mat : matrix of dependencies, should be named (cols and rows), should be square matrix, dependencies are noted 1. 13 | #' @return Dataframe with two columns 'master'and 'slave' 14 | #' 15 | #' @export 16 | mastersSlaves <- function(Mat) { 17 | M_s <- apply(Mat, 1, function(ligne) { 18 | names(which(ligne == 1)) 19 | }) 20 | M_s <- data.frame(master = rep(names(M_s), as.vector(unlist(lapply(M_s, length)))), slave = unlist(M_s, use.names = F)) 21 | return(M_s) 22 | } 23 | 24 | #' For a function, give all dependencies 25 | #' @param envir : environment where the function should search dependencies. 26 | #' @param name.function : function name (character) 27 | #' @return Dataframe with two columns, 'master'and 'slave' 28 | #' 29 | #' @importFrom mvbutils foodweb 30 | #' 31 | #' @export 32 | linksForOne <- function(envir, name.function) { 33 | 34 | current.warn.option <- options("warn")$warn 35 | options(warn = -1) 36 | 37 | graphfun <- mvbutils::foodweb(where = envir, prune = name.function, descendents = F, plotting = F, ancestors = T)$funmat 38 | 39 | while (length(which(rowSums(as.matrix(graphfun)) == 0)) != 1 & length(which(rowSums(as.matrix(graphfun)) == 0)[-which(name.function == 40 | names(which(rowSums(as.matrix(graphfun)) == 0)))]) > 0) { 41 | ligneasupr <- which(rowSums(as.matrix(graphfun)) == 0)[-which(name.function == names(which(rowSums(as.matrix(graphfun)) == 42 | 0)))] 43 | graphfun <- graphfun[-ligneasupr, -ligneasupr] 44 | } 45 | 46 | ancestors <- mastersSlaves(as.matrix(graphfun)) 47 | graphfun <- mvbutils::foodweb(where = envir, prune = name.function, descendents = T, plotting = F, ancestors = F)$funmat 48 | 49 | while (length(which(colSums(as.matrix(graphfun)) == 0)) != 1 & length(which(colSums(as.matrix(graphfun)) == 0)[-which(name.function == 50 | names(which(colSums(as.matrix(graphfun)) == 0)))]) > 0) { 51 | ligneasupr <- which(colSums(as.matrix(graphfun)) == 0)[-which(name.function == names(which(colSums(as.matrix(graphfun)) == 52 | 0)))] 53 | graphfun <- graphfun[-ligneasupr, -ligneasupr] 54 | } 55 | 56 | descendents <- mastersSlaves(as.matrix(graphfun)) 57 | 58 | if (length(ancestors) == 1 || length(ancestors) == 0) { 59 | ancestors = NULL 60 | } 61 | if (length(descendents) == 1 || length(descendents) == 0) { 62 | descendents = NULL 63 | } 64 | 65 | ancdsc <- data.frame(rbind(ancestors, descendents)) 66 | 67 | options(warn = current.warn.option) 68 | if (length(ancdsc) != 0) { 69 | colnames(ancdsc) = c("Master", "Slaves") 70 | return(ancdsc) 71 | } else { 72 | return(NULL) 73 | } 74 | } 75 | 76 | 77 | 78 | #' For a environnement, give all dependencies 79 | #' @param envir : environment where the function should search dependencies. 80 | #' 81 | #' @return Dataframe with two columns, 'master'and 'slave' 82 | #' 83 | #' @importFrom mvbutils foodweb 84 | #' 85 | #' @export 86 | linksForAll <- function(envir) { 87 | 88 | current.warn.option <- options("warn")$warn 89 | options(warn = -1) 90 | 91 | graphfun <- mvbutils::foodweb(where = envir, descendents = F, plotting = F, ancestors = T)$funmat 92 | 93 | 94 | 95 | ancestors <- mastersSlaves(as.matrix(graphfun)) 96 | graphfun <- mvbutils::foodweb(where = envir, descendents = T, plotting = F, ancestors = F)$funmat 97 | 98 | 99 | descendents <- mastersSlaves(as.matrix(graphfun)) 100 | 101 | if (length(ancestors) == 1 || length(ancestors) == 0) { 102 | ancestors = NULL 103 | } 104 | if (length(descendents) == 1 || length(descendents) == 0) { 105 | descendents = NULL 106 | } 107 | 108 | ancdsc <- data.frame(rbind(ancestors, descendents)) 109 | 110 | options(warn = current.warn.option) 111 | if (length(ancdsc) != 0) { 112 | colnames(ancdsc) = c("Master", "Slaves") 113 | return(ancdsc) 114 | } else { 115 | return(NULL) 116 | } 117 | } 118 | 119 | 120 | #' Prepare data for graph visNetwork 121 | #' @param link : Dataframe, two colums, the first is master, the second is slaves 122 | #' @param functions : All functions to includes in graph (default : union(masters & slaves)) 123 | #' @return List contain elements needed for visNetwork visualization 124 | #' 125 | #' @export 126 | prepareToVis <- function(link, functions.list = NULL) { 127 | Visdata <- list() 128 | if (is.null(functions.list)) { 129 | Nomfun <- unique(as.vector(unlist(c(link)))) 130 | Nomfun <- data.frame(cbind(id = 1:length(Nomfun), label = Nomfun)) 131 | } else { 132 | Nomfun <- functions.list 133 | Nomfun <- data.frame(cbind(id = 1:length(Nomfun), label = Nomfun)) 134 | } 135 | 136 | func.link <- sort(unique(c(as.character(link[, 1]), as.character(link[, 2])))) 137 | func.nom <- sort(unique(as.character(Nomfun[, 2]))) 138 | if (!is.null(Nomfun)) { 139 | func.prob <- func.link[which(!func.link %in% func.nom)] 140 | 141 | if (length(func.prob) > 0) { 142 | link <- link[-unique(c(which(link[, 1] %in% func.prob), which(link[, 2] %in% func.prob))), ] 143 | } 144 | } 145 | if (!is.null(link)) { 146 | fromto <- matrix(0, ncol = dim(link)[2], nrow = dim(link)[1]) 147 | if (length(fromto) > 0) { 148 | for (i in 1:dim(link)[1]) { 149 | fromto[i, 1] <- which(as.character(link[i, 2]) == Nomfun[, 2]) 150 | fromto[i, 2] <- which(as.character(link[i, 1]) == Nomfun[, 2]) 151 | if (dim(link)[2] > 2) { 152 | fromto[i, 3:length(link[i, ])] <- link[i, 3:length(link[i, ])] 153 | } 154 | } 155 | } 156 | } else { 157 | fromto <- cbind(0, 0) 158 | } 159 | fromto <- data.frame(fromto) 160 | names(fromto) <- c("from", "to") 161 | Visdata$Nomfun <- Nomfun 162 | Visdata$fromto <- fromto 163 | return(Visdata) 164 | } 165 | 166 | 167 | #' Return all dependencies from a function in an environment 168 | #' @param envir : environment where you want to scherch dependencies 169 | #' @param name.function : Function name (in character) 170 | #' @return List with nodes and edges informations. Needed for visNetwork visualization. 171 | #' 172 | #' @examples 173 | #' 174 | #' dep <- funDependencies('package:ibr','iterchoiceS1') 175 | #' plot(dep) 176 | #' 177 | #' # size 178 | #' plot(dep, height = "800px", width = "100%") 179 | #' 180 | #' @export 181 | funDependencies <- function(envir, name.function) { 182 | visdata <- prepareToVis(linksForOne(envir, name.function)) 183 | class(visdata) <- "dependenciesGraphs" 184 | return(visdata) 185 | } 186 | 187 | 188 | #' Return all dependencies between functions in an environment 189 | #' @param envir : environment on which you want to search dependencies 190 | #' @return List with nodes and edges informations. Needed for visNetwork visualization. 191 | #' @examples 192 | #' 193 | #' dep <- envirDependencies('package:ibr') 194 | #' plot(dep) 195 | #' 196 | #' # size 197 | #' plot(dep, height = "800px", width = "100%") 198 | #' 199 | #' @export 200 | envirDependencies <- function(envir) { 201 | name.functions <- allFunctionEnv(envir) 202 | if (length(name.functions) > 1) { 203 | toutfonc <- linksForAll(envir) 204 | } else { 205 | toutfonc <- data.frame(1, 1) 206 | } 207 | nofunc = FALSE 208 | if (length(name.functions) == 0) { 209 | nofunc = TRUE 210 | name.functions = NULL 211 | } 212 | 213 | visdata <- prepareToVis(unique(toutfonc), name.functions) 214 | if (nofunc) { 215 | visdata$Nomfun$label = "No function found" 216 | } 217 | class(visdata) <- "dependenciesGraphs" 218 | return(visdata) 219 | } 220 | 221 | 222 | #' Return all dependencies between elements of a matrix 223 | #' @param Mat : matrix of dependencies, should be named (cols and rows), should be square matrix, dependencies are noted 1. 224 | #' @return List with nodes and edges informations. Needed for visNetwork visualization. 225 | #' 226 | #' @export 227 | VisFunsmatrice <- function(Mat) { 228 | 229 | data.mat <- mastersSlaves(Mat) 230 | 231 | visdata <- prepareToVis(unique(data.mat), colnames(Mat)) 232 | class(visdata) <- "dependenciesGraphs" 233 | return(visdata) 234 | } 235 | 236 | #' Plot network for dependenciesGraphs object 237 | #' 238 | #' Plot network for dependenciesGraphs object. Using visNetwork package. 239 | #' 240 | #' Plot network for dependenciesGraphs object. Using visNetwork package. 241 | #' 242 | #' @param object : dependenciesGraphs object. 243 | #' @param width : Width (optional, defaults to automatic sizing) 244 | #' @param height : Height (optional, defaults to automatic sizing) 245 | #' 246 | #' @examples 247 | #' 248 | #' dep <- funDependencies('package:ibr','iterchoiceS1') 249 | #' plot(dep) 250 | #' 251 | #' # size 252 | #' plot(dep, height = "800px", width = "100%") 253 | #' 254 | #' @export 255 | #' @method plot dependenciesGraphs 256 | plot.dependenciesGraphs <- function(object, block = FALSE, width = NULL, height = NULL) { 257 | visNetwork(object[[1]], object[[2]], width = width, height = height) %>% 258 | visEdges(arrows = "from") %>% 259 | visOptions(highlightNearest = TRUE, nodesIdSelection = TRUE) %>% 260 | visInteraction(dragNodes = !block) %>% 261 | visPhysics(solver = "repulsion", stabilization = list(enabled = FALSE, iterations = 5000, onlyDynamicEdges = FALSE)) 262 | } 263 | 264 | 265 | 266 | #' Launch shiny app 267 | #' 268 | #' @param path.install.package : Where you have install package DependenciesGraphs. If null, search in current library 269 | #' 270 | #' @export 271 | launch.app <- function(path.install.package = NULL) { 272 | if (is.null(path.install.package)) { 273 | path.install.package <- .libPaths() 274 | 275 | 276 | i <- 1 277 | while (!"DependenciesGraphs" %in% list.files(path.install.package[i])) { 278 | i <- i + 1 279 | } 280 | } 281 | app.path <- paste0(path.install.package[i], "/DependenciesGraphs/Shiny") 282 | shiny::runApp(app.path, launch.browser = TRUE) 283 | 284 | } 285 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DependenciesGraphs : an R package for dependencies visualization between packages and functions 2 | 3 | ## Installation 4 | 5 | Package is actually only available on github : 6 | 7 | ````R 8 | devtools::install_github("datastorm-open/DependenciesGraphs") 9 | ```` 10 | 11 | ## Usage 12 | 13 | For use directly in R, you must first load package(s) using ````library```` function : 14 | 15 | ````R 16 | library("ibr") 17 | ```` 18 | 19 | #### All dependencies between functions in an environment 20 | 21 | ````R 22 | # Prepare data 23 | dep <- envirDependencies("package:ibr") 24 | 25 | # visualization 26 | plot(dep) 27 | ```` 28 | #### All dependencies from a function in an environment 29 | 30 | ````R 31 | # Prepare data 32 | dep <- funDependencies("package:ibr","iterchoiceS1") 33 | 34 | # visualization 35 | plot(dep) 36 | ```` 37 | 38 | #### Explore your R with the shiny app 39 | ````R 40 | launch.app() 41 | ```` 42 | 43 | #### More example 44 | http://datastorm-open.github.io/DependenciesGraphs/ 45 | -------------------------------------------------------------------------------- /inst/HTML/temphelp.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/datastorm-open/DependenciesGraphs/7617b97e52368dae6387859bf50c3856ea23f5e6/inst/HTML/temphelp.html -------------------------------------------------------------------------------- /inst/Shiny/SERVER.R: -------------------------------------------------------------------------------- 1 | optionsDT_fixe <- list(paging = FALSE, searching = FALSE, bInfo = FALSE, search.caseInsensitive = TRUE) 2 | 3 | 4 | shinyServer(function(input, output, session) { 5 | observe({ 6 | input$GOPackage 7 | isolate({ 8 | # print(input$Pack) 9 | if (length(input$packages) > 0) { 10 | data <- Pck.load.to.vis(input$packages) 11 | 12 | func <- c(input$packages) 13 | # print(func) 14 | 15 | 16 | nb.func.slave = NULL 17 | nb.func.master = NULL 18 | for (i in 1:length(func)) { 19 | 20 | id.call <- as.numeric(as.character(data$Nomfun$id[which(func[i] == data$Nomfun$label)])) 21 | 22 | id.call.slave <- as.numeric(as.character(data$fromto$from[which(id.call == data$fromto$to)])) 23 | id.call.master <- as.numeric(as.character(data$fromto$from[which(id.call == data$fromto$from)])) 24 | 25 | nb.call <- length(as.character(data$Nomfun$label[id.call.slave])) 26 | nb.func.slave[i] = nb.call 27 | 28 | nb.call <- length(as.character(data$Nomfun$label[id.call.master])) 29 | nb.func.master[i] = nb.call 30 | 31 | } 32 | 33 | optionsDT_fixe$drawCallback <- I("function( settings ) {document.getElementById('tabledep').style.width = '400px';}") 34 | ## Output first graph 35 | df <- data.frame(Package = func, Import = nb.func.master, `Imported by` = nb.func.slave) 36 | 37 | 38 | 39 | output$tabledep <- renderDataTable({ 40 | df 41 | }, options = optionsDT_fixe) 42 | 43 | output$main_plot <- renderVisNetwork({ 44 | net <- plot(data, block = TRUE) 45 | 46 | # add legend 47 | data_legend <- unique(data2$fromto[, c("title", "color")]) 48 | data_legend$label <- gsub("

", "", data_legend$title, fixed = TRUE) 49 | data_legend$label <- gsub("

", "", data_legend$label, fixed = TRUE) 50 | data_legend$title <- NULL 51 | data_legend$arrows <- "to" 52 | 53 | net %>% 54 | visLegend(addEdges = data_legend, useGroups = FALSE, width = 0.1) 55 | 56 | }) 57 | curentd1 <<- data 58 | output$titledatatabel <- renderText({ 59 | "Dependencies between package(s)" 60 | }) 61 | 62 | } 63 | }) 64 | }) 65 | 66 | 67 | observe({ 68 | current.package <- input$main_plot_selected 69 | current.package <- as.character(curentd1$Nomfun[as.numeric(current.package), "label"]) 70 | updateSelectizeInput(session, "package", NULL, choices = installed.packages()[, 1], selected = current.package) 71 | }) 72 | 73 | observe({ 74 | input$GOFunc2 75 | isolate({ 76 | if (input$package != "" && input$GOFunc2 > 0) { 77 | 78 | func <- input$package 79 | # print(func) 80 | func 81 | 82 | if (!func %in% installed.packages()[, 1]) { 83 | install.packages(func) 84 | } 85 | library(func, character.only = TRUE) 86 | dep1 <- envirDependencies(paste0("package:", func)) 87 | nb.fun <- length(dep1$Nomfun$label) 88 | 89 | 90 | updateTabsetPanel(session, "Tabsetpan", selected = "Functions") 91 | optionsDT_fixe$drawCallback <- I("function( settings ) {document.getElementById('datatable2').style.width = '100px';}") 92 | output$datatable2 <- renderDataTable(data.frame(Number.of.functions = nb.fun), options = optionsDT_fixe) 93 | 94 | output$zoomin <- renderText(paste("Zoom on package ", func)) 95 | output$info <- renderText(paste("Information on package ", func)) 96 | curentd3 <<- func 97 | 98 | output$main_plot1 <- renderVisNetwork({ 99 | plot(dep1, block = TRUE) 100 | }) 101 | curentd2 <<- dep1 102 | } 103 | }) 104 | }) 105 | 106 | observe({ 107 | input$GOFunc1 108 | isolate({ 109 | if (!is.null(input$main_plot_selected) && input$main_plot_selected != "" && input$GOFunc1 > 0) { 110 | 111 | func <- as.character(curentd1$Nomfun$label[input$main_plot_selected == curentd1$Nomfun$id]) 112 | # print(func) 113 | func 114 | 115 | if (!func %in% installed.packages()[, 1]) { 116 | install.packages(func) 117 | } 118 | library(func, character.only = TRUE) 119 | dep1 <- envirDependencies(paste0("package:", func)) 120 | nb.fun <- length(dep1$Nomfun$label) 121 | 122 | 123 | updateTabsetPanel(session, "Tabsetpan", selected = "Functions") 124 | optionsDT_fixe$drawCallback <- I("function( settings ) {document.getElementById('datatable2').style.width = '100px';}") 125 | output$datatable2 <- renderDataTable(data.frame(Number.of.functions = nb.fun), options = optionsDT_fixe) 126 | 127 | output$zoomin <- renderText(paste("Zoom on package : ", func)) 128 | output$info <- renderText(paste("Information on : ", func)) 129 | curentd3 <<- func 130 | 131 | output$main_plot1 <- renderVisNetwork({ 132 | plot(dep1, block = TRUE) 133 | }) 134 | curentd2 <<- dep1 135 | } 136 | }) 137 | }) 138 | 139 | ### chossefunction 140 | 141 | observe({ 142 | input$chargedf 143 | isolate({ 144 | input$packageslist 145 | sapply(input$packageslist, function(x) { 146 | library(x, character.only = TRUE) 147 | }) 148 | allFun <- unique(unlist(sapply(input$packageslist, function(x) { 149 | allFunctionEnv(paste0("package:", x)) 150 | }))) 151 | 152 | updateSelectizeInput(session, inputId = "functionlist", choices = allFun) 153 | }) 154 | }) 155 | 156 | output$chossefunctionplot <- renderVisNetwork({ 157 | input$makegraph 158 | 159 | isolate({ 160 | if (input$makegraph >= 1) { 161 | 162 | plot(allDepFunction(input$packageslist, unlist(strsplit(input$functionlist, split = ";"))), block = TRUE) 163 | } 164 | }) 165 | 166 | }) 167 | 168 | observe({ 169 | 170 | if (!is.null(input$main_plot1_selected) && input$main_plot1_selected != "") { 171 | isolate({ 172 | pck <- curentd3 173 | 174 | # print(pck) 175 | 176 | func <- as.character(curentd2$Nomfun$label[input$main_plot1_selected == curentd2$Nomfun$id]) 177 | # print(func) 178 | try(add.html.help(pck, func), TRUE) 179 | 180 | if (length(htmlTreeParse(paste0(getwd(), "/temp.html"))$children$html) > 0) { 181 | output$help <- renderUI(includeHTML(paste0(getwd(), "/temp.html"))) 182 | 183 | } else { 184 | output$help <- renderUI("Not available help for this function") 185 | } 186 | }) 187 | } else { 188 | 189 | output$help <- renderUI("Select a function") 190 | } 191 | 192 | }) 193 | 194 | observe({ 195 | 196 | if (!is.null(input$main_plot_selected) && input$main_plot_selected != "") { 197 | 198 | func <- as.character(curentd1$Nomfun$label[input$main_plot_selected == curentd1$Nomfun$id]) 199 | 200 | output$Groupebutton <- renderUI({ 201 | 202 | div(hr(), actionButton("GOFunc1", paste0("Launch zoom on : ", func), icon = icon("line-chart")), align = "center") 203 | 204 | }) 205 | } else { 206 | output$Groupebutton <- renderUI({ 207 | NULL 208 | }) 209 | } 210 | 211 | }) 212 | 213 | 214 | 215 | observe({ 216 | 217 | input$GObott 218 | # input$file1 will be NULL initially. After the user selects and uploads a file, it will be a data frame with 'name', 'size', 219 | # 'type', and 'datapath' columns. The 'datapath' column will contain the local filenames where the data can be found. 220 | 221 | inFile <- input$file1 222 | 223 | if (!is.null(inFile)) { 224 | dep <- data.graph.script(inFile$datapath) 225 | output$plotscript <- renderVisNetwork({ 226 | plot(dep, block = TRUE) 227 | }) 228 | } 229 | }) 230 | }) 231 | -------------------------------------------------------------------------------- /inst/Shiny/UI.R: -------------------------------------------------------------------------------- 1 | dashboardPage( 2 | dashboardHeader(title = "DependenciesGraphs"), 3 | dashboardSidebar(sidebarMenu(id = "Tabsetpan", 4 | menuItem("Packages", tabName = "Packages", icon = icon("dashboard")), 5 | conditionalPanel(condition = "input.Tabsetpan === 'Packages'", 6 | selectInput('packages', "Package(s) :", choices = installed.packages()[,1], multiple = T, width = "100%"), 7 | div(actionButton("GOPackage", "Go !",icon = icon("line-chart")), align = "center") 8 | ), 9 | menuItem("Functions", tabName = "Functions", icon = icon("th")), 10 | conditionalPanel(condition = "input.Tabsetpan === 'Functions'", 11 | selectInput('package', "Package : ", choices = installed.packages()[,1], multiple = FALSE, width = "100%"), 12 | div(actionButton("GOFunc2", "Go !",icon = icon("line-chart")), align = "center") 13 | ), 14 | menuItem("Custom", tabName = "Custom", icon = icon("th")) 15 | 16 | )), 17 | dashboardBody( 18 | # Boxes need to be put in a row (or column) 19 | tags$head(tags$link(rel='stylesheet', type='text/css', href='style.css')), 20 | tabItems( 21 | # First tab content 22 | tabItem(tabName = "Packages", 23 | # fluidRow( 24 | # column(3, div(h3('Package(s) selection :'), align = "center")), 25 | # column(6, br(), selectInput('packages', NULL, choices = installed.packages()[,1], multiple = T, width = "100%")), 26 | # column(3, br(), div(actionButton("GOPackage", "Launch",icon = icon("line-chart")), align = "center")) 27 | # ), 28 | # hr(), 29 | 30 | fluidRow( 31 | box( 32 | solidHeader = TRUE, collapsible = TRUE, title = "Dependencies between package(s)", 33 | status = "primary", 34 | visNetworkOutput("main_plot", width = "100%",height = "750px"), 35 | br() 36 | ,width = 12 37 | ), 38 | box( 39 | solidHeader = TRUE, collapsible = TRUE, title = "Informations", 40 | status = "primary", 41 | div( 42 | dataTableOutput("tabledep"), 43 | uiOutput("Groupebutton"), 44 | align="center" 45 | ), 46 | width=12) 47 | ) 48 | 49 | ), 50 | tabItem(tabName = "Functions", 51 | fluidRow( 52 | box( 53 | solidHeader = TRUE, collapsible = TRUE, title = "Dependencies between functions", 54 | status = "primary", 55 | div(h4(textOutput("zoomin")), align = "center"), 56 | visNetworkOutput("main_plot1", width = "100%",height = "750px"), 57 | br() 58 | ,width = 12 59 | ), 60 | box( 61 | solidHeader = TRUE, collapsible = TRUE, title = "Informations", 62 | status = "primary", 63 | div( 64 | # h4(textOutput("info")), 65 | dataTableOutput("datatable2") 66 | ,align="center" 67 | ), 68 | width=12) 69 | ), 70 | 71 | fluidRow( 72 | box( 73 | uiOutput("help"),width = 12 74 | ) 75 | ) 76 | ), 77 | # tabPanel("Script", 78 | # 79 | # 80 | # fluidRow( 81 | # box( 82 | # fileInput('file1', 'Choose R File', 83 | # accept=NULL), 84 | # visNetworkOutput("plotscript", width = "100%",height = "700px") 85 | # ,width = 12) 86 | # ) 87 | # ), 88 | 89 | tabItem(tabName = "Custom", 90 | 91 | 92 | fluidRow( 93 | box( 94 | fluidRow( 95 | column(width=4, 96 | selectizeInput(inputId = "packageslist" , "Package(s) :", choices = installed.packages()[,1], multiple = TRUE) 97 | ), 98 | column(width=2, 99 | br(), div(actionButton("chargedf", "Find functions", style = "padding: 8px 20px 8px 20px;"),align="center") 100 | ), 101 | column(width=4, 102 | selectizeInput(inputId = "functionlist" , "Function(s) :", choices = NULL, multiple = TRUE) 103 | ), 104 | column(width=2, 105 | br(), div(actionButton("makegraph", "Make graph", style = "padding: 8px 20px 8px 20px;"),align = "center") 106 | ) 107 | ), 108 | 109 | hr(), 110 | visNetworkOutput("chossefunctionplot", width = "100%",height = "750px"), 111 | br(), 112 | width = 12) 113 | ) 114 | ) 115 | 116 | 117 | ) 118 | ) 119 | ) 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /inst/Shiny/global.R: -------------------------------------------------------------------------------- 1 | require(XML) 2 | require(shinydashboard) 3 | require(DependenciesGraphs) 4 | curentd2 <<- NULL 5 | curentd1 <<- NULL 6 | curentd3 <<- NULL 7 | 8 | -------------------------------------------------------------------------------- /inst/Shiny/temp.html: -------------------------------------------------------------------------------- 1 | R: Extract simulation options 2 | 3 | 4 | 5 | 6 |
simOptionsR Documentation
7 | 8 |

Extract simulation options

9 | 10 |

Description

11 | 12 |

The function readAntares stores in its output the options used 13 | to read some data (path of the study, area list, link list, start date, 14 | etc.). 15 |

16 | 17 | 18 |

Usage

19 | 20 |
21 | simOptions(x = NULL)
22 | 
23 | 24 | 25 |

Arguments

26 | 27 | 28 | 29 | 32 |
x 30 |

object of class antaresTable or antaresData

31 |
33 | 34 | 35 |

Details

36 | 37 |

simOptions extracts these options from an object of class 38 | antaresTable or antaresOutput. It can be useful when working on 39 | multiple simulations, either to check how some object has been created or to 40 | use it in some functions like getAreas or 41 | getLinks 42 |

43 |

If the parameter of the function is NULL, it returns the default 44 | simulation options, that is the options set by setSimulationPath 45 | the last time it was run. 46 |

47 | 48 | 49 |

Value

50 | 51 |

list of options used to read the data contained in an object or the last 52 | simulation options read by setSimulationPath if x is 53 | NULL 54 |

55 | 56 | 57 |

Examples

58 | 59 |
60 | ## Not run: 
61 |   setSimulationPath(study1)
62 |   
63 |   simOptions() # returns the options for study 1
64 |   
65 |   data <- readAntares()
66 |   
67 |   # Choose a different study
68 |   setSimulationPath(study2)
69 |   
70 |   simOptions() # returns the options for study 2
71 |   
72 |   getAreas() # returns the areas of the secund study
73 |   getAreas(opts = simOptions(data)) # returns the areas of the first study
74 |   
75 | 
76 | ## End(Not run)
77 | 
78 | 
79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /inst/Shiny/www/style.css: -------------------------------------------------------------------------------- 1 | button.btn.btn-default.action-button { 2 | background: #3498db; 3 | background-image: -webkit-linear-gradient(top, #3498db, #2980b9); 4 | background-image: -moz-linear-gradient(top, #3498db, #2980b9); 5 | background-image: -ms-linear-gradient(top, #3498db, #2980b9); 6 | background-image: -o-linear-gradient(top, #3498db, #2980b9); 7 | background-image: linear-gradient(to bottom, #3498db, #2980b9); 8 | -webkit-border-radius: 28; 9 | -moz-border-radius: 28; 10 | border-radius: 28px; 11 | font-family: Arial; 12 | color: #ffffff; 13 | font-size: 20px; 14 | padding: 2px 20px 2px 20px; 15 | text-decoration: none; 16 | } 17 | 18 | button.btn.btn-default.action-button:hover { 19 | background: #3cb0fd; 20 | background-image: -webkit-linear-gradient(top, #3cb0fd, #3498db); 21 | background-image: -moz-linear-gradient(top, #3cb0fd, #3498db); 22 | background-image: -ms-linear-gradient(top, #3cb0fd, #3498db); 23 | background-image: -o-linear-gradient(top, #3cb0fd, #3498db); 24 | background-image: linear-gradient(to bottom, #3cb0fd, #3498db); 25 | text-decoration: none; 26 | } 27 | 28 | 29 | 30 | 31 | 32 | 33 | .shiny-datatable-output table 34 | { 35 | border: 3px solid blue; 36 | text-align: center; 37 | font-size: 20px; 38 | } 39 | 40 | .shiny-datatable-output td{ 41 | border: 1px solid blue; 42 | background-color: #FCFCFC; 43 | } 44 | 45 | .shiny-datatable-output thead{ 46 | text-align: center; 47 | background-color: #FFFFFF; 48 | border-bottom: 3px solid blue; 49 | } 50 | 51 | .shiny-datatable-output th{ 52 | 53 | text-align: center; 54 | border: 1px solid blue; 55 | } 56 | -------------------------------------------------------------------------------- /inst/Test.R: -------------------------------------------------------------------------------- 1 | 2 | library(FactoMineR) 3 | require(ibr) 4 | library(FactoMineR) 5 | require(FactoMineR) 6 | data(decathlon) 7 | data(tea) 8 | res.pca <- PCA(decathlon, quanti.sup = 11:12, quali.sup = 13) 9 | 10 | 11 | essaifun <- function(lala) { 12 | lala = lala + 1 13 | } 14 | 15 | essaifun2 <- function(lolo0) { 16 | essaifun 17 | } 18 | 19 | essaifun3 <- function(lolo0) { 20 | hhihi <- MCA(tea, quanti.sup = 19, quali.sup = 20:36) 21 | return(hhihi) 22 | } 23 | 24 | nn <- essaifun3() 25 | data(ozone, package = "ibr") 26 | res.ibr <- ibr(ozone[, -1], ozone[, 1], df = 1.1) 27 | 28 | -------------------------------------------------------------------------------- /man/Pck.load.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/DepInterPackages.R 3 | \name{Pck.load} 4 | \alias{Pck.load} 5 | \title{Given dependencies between all install packages} 6 | \usage{ 7 | Pck.load() 8 | } 9 | \value{ 10 | List of dependencies 11 | } 12 | \description{ 13 | Given dependencies between all install packages 14 | } 15 | -------------------------------------------------------------------------------- /man/Pck.load.to.vis.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/DepInterPackages.R 3 | \name{Pck.load.to.vis} 4 | \alias{Pck.load.to.vis} 5 | \title{Given dependencies between all install packages} 6 | \usage{ 7 | Pck.load.to.vis(Packages = "All", color.table = c("#0B0B3B", "#0404B4", 8 | "#5858FA", "#A9A9F5")) 9 | } 10 | \arguments{ 11 | \item{Packages}{: Names of packages to includes to extract} 12 | 13 | \item{color.table}{: Name of color to use} 14 | } 15 | \value{ 16 | List to graph 17 | } 18 | \description{ 19 | Given dependencies between all install packages 20 | } 21 | -------------------------------------------------------------------------------- /man/VisFunsmatrice.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/VisGraphAuto.R 3 | \name{VisFunsmatrice} 4 | \alias{VisFunsmatrice} 5 | \title{Return all dependencies between elements of a matrix} 6 | \usage{ 7 | VisFunsmatrice(Mat) 8 | } 9 | \arguments{ 10 | \item{Mat}{: matrix of dependencies, should be named (cols and rows), should be square matrix, dependencies are noted 1.} 11 | } 12 | \value{ 13 | List with nodes and edges informations. Needed for visNetwork visualization. 14 | } 15 | \description{ 16 | Return all dependencies between elements of a matrix 17 | } 18 | -------------------------------------------------------------------------------- /man/add.html.help.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/DepInterPackages.R 3 | \name{add.html.help} 4 | \alias{add.html.help} 5 | \title{Given html help for a function} 6 | \usage{ 7 | add.html.help(package, func, tempsave = paste0(getwd(), "/temp.html")) 8 | } 9 | \arguments{ 10 | \item{package}{: Names of package to extract help} 11 | 12 | \item{func}{: Name of function to extract help} 13 | 14 | \item{tempsave}{: Tempory file to save help} 15 | } 16 | \description{ 17 | Given html help for a function 18 | } 19 | -------------------------------------------------------------------------------- /man/allDepFunction.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/LinkAll.R 3 | \name{allDepFunction} 4 | \alias{allDepFunction} 5 | \title{For a function, give all dependencies} 6 | \usage{ 7 | allDepFunction(envir, name.functions) 8 | } 9 | \arguments{ 10 | \item{envir}{: environments where the function should search dependencies.} 11 | 12 | \item{name.function}{: function name (character)} 13 | } 14 | \value{ 15 | object of class dependenciesGraphs 16 | } 17 | \description{ 18 | For a function, give all dependencies 19 | } 20 | -------------------------------------------------------------------------------- /man/allFunctionEnv.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/VisGraphAuto.R 3 | \name{allFunctionEnv} 4 | \alias{allFunctionEnv} 5 | \title{Given a environment, can be a package, returns a vector of included functions in this environment} 6 | \usage{ 7 | allFunctionEnv(name, envir) 8 | } 9 | \arguments{ 10 | \item{envir}{: Environment, try 'search()' to obtain a list of loaded environments} 11 | } 12 | \value{ 13 | Names of included functions in this environment. 14 | } 15 | \description{ 16 | Given a environment, can be a package, returns a vector of included functions in this environment 17 | } 18 | -------------------------------------------------------------------------------- /man/data.graph.script.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/Sourcescript.R 3 | \name{data.graph.script} 4 | \alias{data.graph.script} 5 | \title{Dependencies for scripts} 6 | \usage{ 7 | data.graph.script(path) 8 | } 9 | \arguments{ 10 | \item{path}{: path of R Script} 11 | } 12 | \description{ 13 | Dependencies for scripts 14 | } 15 | \examples{ 16 | 17 | dep <- data.graph.script('MyRScrpt.R') 18 | plot(dep) 19 | 20 | } 21 | -------------------------------------------------------------------------------- /man/envirDependencies.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/VisGraphAuto.R 3 | \name{envirDependencies} 4 | \alias{envirDependencies} 5 | \title{Return all dependencies between functions in an environment} 6 | \usage{ 7 | envirDependencies(envir) 8 | } 9 | \arguments{ 10 | \item{envir}{: environment on which you want to search dependencies} 11 | } 12 | \value{ 13 | List with nodes and edges informations. Needed for visNetwork visualization. 14 | } 15 | \description{ 16 | Return all dependencies between functions in an environment 17 | } 18 | \examples{ 19 | 20 | dep <- envirDependencies('package:ibr') 21 | plot(dep) 22 | 23 | # size 24 | plot(dep, height = "800px", width = "100\%") 25 | 26 | } 27 | -------------------------------------------------------------------------------- /man/funDependencies.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/VisGraphAuto.R 3 | \name{funDependencies} 4 | \alias{funDependencies} 5 | \title{Return all dependencies from a function in an environment} 6 | \usage{ 7 | funDependencies(envir, name.function) 8 | } 9 | \arguments{ 10 | \item{envir}{: environment where you want to scherch dependencies} 11 | 12 | \item{name.function}{: Function name (in character)} 13 | } 14 | \value{ 15 | List with nodes and edges informations. Needed for visNetwork visualization. 16 | } 17 | \description{ 18 | Return all dependencies from a function in an environment 19 | } 20 | \examples{ 21 | 22 | dep <- funDependencies('package:ibr','iterchoiceS1') 23 | plot(dep) 24 | 25 | # size 26 | plot(dep, height = "800px", width = "100\%") 27 | 28 | } 29 | -------------------------------------------------------------------------------- /man/launch.app.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/VisGraphAuto.R 3 | \name{launch.app} 4 | \alias{launch.app} 5 | \title{Launch shiny app} 6 | \usage{ 7 | launch.app(path.install.package = NULL) 8 | } 9 | \arguments{ 10 | \item{path.install.package}{: Where you have install package DependenciesGraphs. If null, search in current library} 11 | } 12 | \description{ 13 | Launch shiny app 14 | } 15 | -------------------------------------------------------------------------------- /man/linksForAll.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/VisGraphAuto.R 3 | \name{linksForAll} 4 | \alias{linksForAll} 5 | \title{For a environnement, give all dependencies} 6 | \usage{ 7 | linksForAll(envir) 8 | } 9 | \arguments{ 10 | \item{envir}{: environment where the function should search dependencies.} 11 | } 12 | \value{ 13 | Dataframe with two columns, 'master'and 'slave' 14 | } 15 | \description{ 16 | For a environnement, give all dependencies 17 | } 18 | -------------------------------------------------------------------------------- /man/linksForOne.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/VisGraphAuto.R 3 | \name{linksForOne} 4 | \alias{linksForOne} 5 | \title{For a function, give all dependencies} 6 | \usage{ 7 | linksForOne(envir, name.function) 8 | } 9 | \arguments{ 10 | \item{envir}{: environment where the function should search dependencies.} 11 | 12 | \item{name.function}{: function name (character)} 13 | } 14 | \value{ 15 | Dataframe with two columns, 'master'and 'slave' 16 | } 17 | \description{ 18 | For a function, give all dependencies 19 | } 20 | -------------------------------------------------------------------------------- /man/mastersSlaves.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/VisGraphAuto.R 3 | \name{mastersSlaves} 4 | \alias{mastersSlaves} 5 | \title{Given a matrix, returns a dataframe which two columns 'master'and 'slave'} 6 | \usage{ 7 | mastersSlaves(Mat) 8 | } 9 | \arguments{ 10 | \item{Mat}{: matrix of dependencies, should be named (cols and rows), should be square matrix, dependencies are noted 1.} 11 | } 12 | \value{ 13 | Dataframe with two columns 'master'and 'slave' 14 | } 15 | \description{ 16 | Given a matrix, returns a dataframe which two columns 'master'and 'slave' 17 | } 18 | -------------------------------------------------------------------------------- /man/plot.dependenciesGraphs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/VisGraphAuto.R 3 | \name{plot.dependenciesGraphs} 4 | \alias{plot.dependenciesGraphs} 5 | \title{Plot network for dependenciesGraphs object} 6 | \usage{ 7 | \method{plot}{dependenciesGraphs}(object, block = FALSE, width = "100\%", 8 | height = "400px") 9 | } 10 | \arguments{ 11 | \item{object}{: dependenciesGraphs object.} 12 | 13 | \item{width}{: Width (optional, defaults to automatic sizing)} 14 | 15 | \item{height}{: Height (optional, defaults to automatic sizing)} 16 | } 17 | \description{ 18 | Plot network for dependenciesGraphs object. Using visNetwork package. 19 | } 20 | \details{ 21 | Plot network for dependenciesGraphs object. Using visNetwork package. 22 | } 23 | \examples{ 24 | 25 | dep <- funDependencies('package:ibr','iterchoiceS1') 26 | plot(dep) 27 | 28 | # size 29 | plot(dep, height = "800px", width = "100\%") 30 | 31 | } 32 | -------------------------------------------------------------------------------- /man/prepareToVis.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/VisGraphAuto.R 3 | \name{prepareToVis} 4 | \alias{prepareToVis} 5 | \title{Prepare data for graph visNetwork} 6 | \usage{ 7 | prepareToVis(link, functions.list = NULL) 8 | } 9 | \arguments{ 10 | \item{link}{: Dataframe, two colums, the first is master, the second is slaves} 11 | 12 | \item{functions}{: All functions to includes in graph (default : union(masters & slaves))} 13 | } 14 | \value{ 15 | List contain elements needed for visNetwork visualization 16 | } 17 | \description{ 18 | Prepare data for graph visNetwork 19 | } 20 | --------------------------------------------------------------------------------