# This function receives a list of packages to be installed before the execution of a script. # For each package provided, it verifies that it is not installed already. If so, it proceeds to # install it. # ToDo: exception control for unexistent/misspelled packages. install_dependencies <- function(dep_list) { # Deprecated since executing server is Ubuntu. #if(Sys.info()["sysname"] == "Windows"){ # dep_list[length(dep_list)+1] = "Rtools" #} for(p in dep_list){ if(require(p, character.only = T) == FALSE){ if(p == "dsBaseClient"){ library(remotes) install_github("datashield/dsBaseClient", dependencies = TRUE) }else{ if(p == "DSI"){ library(remotes) install_github('datashield/DSI', ref = '1.3.3', dependencies = TRUE) }else{ install.packages(p, dependencies = TRUE, repos = "https://cran.us.r-project.org") } } } if(p != "Rtools"){ library(p, character.only = T) } } }