i have a for loop in a batch file which runs the same r script with different parameters and i want all output to be appended to the same file.
here is an example:
Batch Code
for %%i in ([folder name]) do (
R CMD BATCH --slave "--args %%i" Script.R output.out
)
Script.R Code
cmdArgs = commandArgs(trailingOnly = TRUE)
cat("Args: ", cmdArgs[1], "\n")
cat("End")
I have tried using 2>&1 and it's not working.
I am using a windows machine and prefer not to redirect output from within the R script and can't user RScript, any ideas?