Skip to content

R and R-Studio

They are statistical language and ID

  • r or R - R console in terminal
  • Rscript my.r - executes file in terminal
  • Rscript -e "getwd()" - executes cmd in terminal, can quickly install a library.
  • R CMD BATCH my.r runs R script and saves output to my.r.Rout
  • To make R Script executable like ./my.r then:
    • set permission to 755
    • add correct #! to top of file
#!/usr/bin/env Rscript
sayHello <- function(){
   print('hello')
}

sayHello()

2025-01-12 January 12, 2025