# I- Install/Update gmr and load packages ----
rm(list = ls()) # Clean your R session
# Set the working directory as the directory of this document
setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
# check your directory
getwd()
# Install and load the packages
# 1.Install devtools and gdata on your machine
if (!require("devtools")) {
# install devtools
install.packages("devtools")
}
if (!require("gdata")) {
# needed to manipulate data
install.packages("gdata")
}
# 2. Install / update gmr package
Src <- "GMACS-project/gmr"
# Get the latest version of gmr? (0: no; 1: install for the first time; 2: update the package)
Update <-
0
# Inidicate the library directory to remove the gmr package from
mylib <-
"~/R/win-library/4.1"
# remotes::install_github() will work to install gmr on your machine
if (Update == 1)
devtools::install_github(Src)
# Updating to the latest version of gmr
if (Update == 2) {
remove.packages("gmr", lib = mylib)
devtools::install_github(Src)
}
# Load the gmr package
library(gmr)
# -----------------------------------------------------------
res <- GMACS(
Spc = Stock,
GMACS_version = GMACS_version,
Dir = VERSIONDIR,
ASS = ASS,
compile = COMPILE,
run = RUN_GMACS,
LastAssDat = LastAssDat,
ADMBpaths = ADMBpaths,
make.comp = MAKE_Comp,
verbose = VERBOSE,
cleanOut = TRUE
)