Skip to main content
It looks like you're using Internet Explorer 11 or older. This website works best with modern browsers such as the latest versions of Chrome, Firefox, Safari, and Edge. If you continue with this browser, you may see unexpected results.


Program Conventions

A ".R" file is where you write code to run procedures and/or commands to analyze or manipulate data.

Opening a blank .R file can be done on the main window of RStudio. To start, open RStudio on your computer and in the upper left corner of the window click on "File" --> "New File"--> "R Script"  to begin writing code. You may also type 'control+shift+N'.  


To save a .R file, click on the floppy disk icon highlighted in the red circle.



We can think of a .R file as a ‘live’ word document, where we write commands that tell RStudio what to do with our data from descriptive statistics to regression models.

RStudio code is written with commands which are the main function or analysis you want RStudio to do in a line of code.

By starting a line with a “ # “, we can write notes and comments that will appear green. RStudio does not recognize this as code.


#Frequency of language


You can also write blocks of text that do not appear as code by also starting the text with a " # ".

Blocking off code

#The information will appear in the "help" section when using RStudio
help(SLID)#this code will help us find more information about the data


To run code, that is to tell RStudio what you want to do, highlight the code you want to run and click on the 'Run' button highlighted in red below. You can also type "Alt+Enter" on a widows keyboard.