I have some R code inside a file called analyse.r. I would like to be able to, from the command line (CMD), run the code in that file without having to pass through the R te
save the following in a text file
f1 <- function(x,y){ print (x) print (y) } args = commandArgs(trailingOnly=TRUE) f1(args[1], args[2])
No run the following command in windows cmd
Rscript.exe path_to_file "hello" "world"
This will print the following
[1] "hello" [1] "world"