If you want to script R with arguments, you can type (under a Linux shell):
R --no-restore --no-save --args 10 < script.R |
where –args is a list of arguments that you want to use in your script. This script will contain the following commands:
args <- commandArgs(trailingOnly=TRUE) |
where trailingOnly means that commandArgs uses only the –args option so that you do not have to bother about the position of th –args argument.
Please follow and like us: