From 2c9b268402d769382845a5edd48df814129c6091 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Holl=C3=B3s?= Date: Mon, 15 Apr 2019 11:57:55 +0200 Subject: [PATCH] Modify the installation scripts! --- RBBGCMuso/R/setupMuso6.R | 47 ++++++++++++++++++++++++++++++++++++++++ installDeps.R | 12 +++++++++- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 RBBGCMuso/R/setupMuso6.R diff --git a/RBBGCMuso/R/setupMuso6.R b/RBBGCMuso/R/setupMuso6.R new file mode 100644 index 0000000..d6f465b --- /dev/null +++ b/RBBGCMuso/R/setupMuso6.R @@ -0,0 +1,47 @@ +## #' setupMuso6 +## #' +## #' This is the setup function for MuSo version: 6 +## #' +## #' @author Roland HOLLOS +## #' @param setupFile +## #' @export + +## setupMuso6<- function(setupFile){ + +## } + +## ini <- readLines("./hhs_apriori_MuSo6_normal.ini") +## flags <- c("MET_INPUT", +## "RESTART", +## "TIME_DEFINE", +## "CO2_CONTROL", +## "NDEP_CONTROL", +## "SITE", +## "SOILPROP_FILE", +## "EPC_FILE", +## "MANAGEMENT_FILE", +## "SIMULATION_CONTROL", +## "W_STATE", +## "CN_STATE", +## "CLIM_CHANGE", +## "CONDITIONAL_MANAGEMENT_STRATEGIES", +## "OUTPUT_CONTROL", +## "DAILY_OUTPUT", +## "ANNUAL_OUTPUT", +## "END_INIT") +## getSegments <- function(ini, flags){ +## output <- list() +## flagIterator <- 1:(length(flags)-1) +## for(i in flagIterator){ +## output[[flags[i]]] <- lapply(ini[(grep(flags[i],ini)+1):(grep(flags[i+1],ini)-2)], function(x){ +## unlist(strsplit(x,split = "\\["))[1] +## }) +## } +## output +## } +## getSegments(ini,flags) + +## gsub("(.*\\[\\|)([a-zA-Z1-9_]*)","",ini) +## stringi::stri_trim_right("rexamine.com/", "\\[r\\]") +## stri_extract("asdfasdf [|Ezat|]",regex = "\\[\\|*\\]") +## lapply(ini,function(x) gsub("\\s","",(strsplit(x,split= "T]"))[[1]][2])) diff --git a/installDeps.R b/installDeps.R index acdaae6..3f46dcd 100644 --- a/installDeps.R +++ b/installDeps.R @@ -1,8 +1,18 @@ (function(){ packagesToInstall <- c("shiny","shinyjs","plotly","promises","future","data.table","rhandsontable") - sapply(packagesToInstall, function(pkgs){ + installedp<- sapply(packagesToInstall, function(pkgs){ if(!is.element(pkgs,installed.packages()[,1])){ install.packages(pkgs) + if(!is.element(pkgs,installed.packages([,1]))){ + return(FALSE) + } else { + return(TRUE) + } + } else { + return(TRUE) } }) + if(any(!installedp)){ + stop("The installation process was not successful. Please try rerun the installation!") + } })()