Hi #rstats/#r4ds! I'm trying to create and save 18 versions of a same R script, with just one parameter that differs, like: param <- 1 (in first version) … param <- 18 (in last version) The files are also named differently. Is there a way to automate this to avoid errors?
3
2
1
Possible alternative: param <- as.numeric(Sys.getenv("MYVALUE")) The run a shell script around it it calling it: for v in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18; do MYVALUE=v Rscript myRfile.R done
1
5
There are other ways to pass values to an Rstats script; I like `docopt` my @edwindjonge *a lot* for this. You could pick up values from a config file you alter, or from a parameter store like Redis, or ... But keeping 18 variants of the same source file is not not good.

Oct 15, 2021 · 3:21 PM UTC

2
1
2
Yes I agree it's not ideal! The reason is that I run them remotely as independent individual slurm jobs on an HPC
1
Thank you I'm gonna look into both :)