Difference between revisions of "Rocky R HelloWorld"

From NIMBioS
(Created page with "= R Code = '''helloworld.R''' <pre> print("Hello World!") </pre> = Batch Script = '''helloworld.run''' <pre> #SBATCH --job-name=R_HELLOWORLD #SBATCH --output=R_hello_%j.out module load R/4.2.1-foss-2022a Rscript helloworld. </pre> = Running Job = <pre> [test_user@rocky7 helloworld]$ pwd /home/test_user/projects/R/helloworld </pre> <pre> [test_user@rocky7 helloworld]$ ls helloworld.R helloworld.run </pre> <pre> [test_user@rocky7 helloworld]$ sbatch helloworld.r...")
 
m
 
(2 intermediate revisions by 2 users not shown)
Line 11: Line 11:
'''helloworld.run'''
'''helloworld.run'''
<pre>
<pre>
#!/bin/bash
#SBATCH --job-name=R_HELLOWORLD
#SBATCH --job-name=R_HELLOWORLD
#SBATCH --output=R_hello_%j.out
#SBATCH --output=R_hello_%j.out
Line 16: Line 18:
module load R/4.2.1-foss-2022a  
module load R/4.2.1-foss-2022a  


Rscript helloworld.
Rscript helloworld.R
</pre>
</pre>


Line 36: Line 38:
<pre>
<pre>
[test_user@rocky7 helloworld]$ ls
[test_user@rocky7 helloworld]$ ls
helloworld.py  helloworld.run  python_hell0_3875.out
helloworld.py  helloworld.run  R_hell0_3875.out
</pre>
</pre>
<pre>
<pre>
[test_user@rocky7 helloworld]$ cat python_hell0_3875.out  
[test_user@rocky7 helloworld]$ cat R_hell0_3875.out  
Hello World!
Hello World!
</pre>
</pre>

Latest revision as of 18:37, 25 April 2023

R Code

helloworld.R

print("Hello World!")


Batch Script

helloworld.run

#!/bin/bash

#SBATCH --job-name=R_HELLOWORLD
#SBATCH --output=R_hello_%j.out

module load R/4.2.1-foss-2022a 

Rscript helloworld.R


Running Job

[test_user@rocky7 helloworld]$ pwd
/home/test_user/projects/R/helloworld
[test_user@rocky7 helloworld]$ ls
helloworld.R  helloworld.run
[test_user@rocky7 helloworld]$ sbatch helloworld.run 
Submitted batch job 3875
[test_user@rocky7 helloworld]$ ls
helloworld.py  helloworld.run  R_hell0_3875.out
[test_user@rocky7 helloworld]$ cat R_hell0_3875.out 
Hello World!