I need to run PBS Job Arrays. In these scripts, I need to run R in a conda environment.
To run my jobs as arrays, I need to be able to call up variables previously defined by my pbs script (typically, the working directory, the names of individuals...).
I have a R script launched by a pbs job exactly like this :
########################################
## Load environment ##
########################################
. /appli/anaconda/latest/etc/profile.d/conda.sh
########################################
## Execute script ##
########################################
conda activate r4-base
Rscript $HOME/Documents/script/fm_fit_model.r
conda deactivate
Is there a way I can modify my variables in my Rscript by defining variables in my PBS jobs. For example, I would like to define the variable species=fish in my pbs script and that it would modify the corresponding variable in my R script, so that I can make everything run in arrays.