I am currently trying to run an R script via a shell script.
Here the R script:
test = rnorm(1:100, 1000)
write.csv(test, 'test.csv')
And here the bash script which calls the R one:
#!/bin/bash -l
#SBATCH --partition=compute
#SBATCH --job-name=test
#SBATCH --mail-type=ALL
#SBATCH [email protected]
#SBATCH --time=00:10:00
#SBATCH --nodes=1
#SBATCH --tasks-per-node=12
#SBATCH --account=myaccount
module purge
module load R
${HOME}/test.R
I think I did everything correctly, but the output returns the following error:
/mydirectory/test.R: line 3: syntax error near unexpected token `('
/mydirectory/test.R: line 3: `test = rnorm(1:100, 1000)'
Why I did I get this error?
ls -l ${HOME}/test.R?logging into Rfrom the command line directly and use that same approach in the shell script