Modify the installation scripts!

This commit is contained in:
Roland Hollós 2019-04-15 11:57:55 +02:00
parent ae29113f66
commit 2c9b268402
2 changed files with 58 additions and 1 deletions

47
RBBGCMuso/R/setupMuso6.R Normal file
View File

@ -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]))

View File

@ -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!")
}
})()