I'm trying to make helloworld.R
run. I have given it executable rights and have added #!/usr/bin/Rscript
at the top of the file. (I have also attempted #!/usr/bin/en Rscript
). It is a relatively simple file:
#!/usr/bin/Rscript
x <- rnorm(100)
df <- data.frame(x = x)
write.csv(df, "sim_data.csv")
However, any attempt to run the file has been met with the following error
ARGUMENT '/home/path/to/file/helloworld.R' __ignored__
R version 3.4.3 (2017-11-30) -- "Kite-Eating Tree"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
(...)
Surprisingly, renaming the file to helloworld.py
lets it run just fine (and outputs sim_data.csv
with its expected content), but this seems hacky, so I was wondering if there was a better solution.