The Script
#!/usr/local/bin/Rscript --slave
args <- commandArgs(TRUE)
print(args);
The Shell Command
~/Rscript my_script.R hello 10 3
The Output
[1] "hello" "0" "10"
I was expecting an array like:
[1] "hello"
[2] "0"
[3] "10"
So what am I doing wrong?
That’s just how a vector is printed in R, the same as if you’d created it like this:
Try
and you’ll see that each accesses the appropriate string.