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
table(SLID$language)
You can also write blocks of text that do not appear as code by also starting the text with a " # ".
Blocking off code
###DATASET INFORMATION###
#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.