How do I write a script in R?

To start writing a new R script in RStudio, click File – New File – R Script. Shortcut!

To create a new script in R, you can also use the command–shift–N shortcut on Mac.