Skip to Main Content

Intro to R Programming

R is a powerful tool for data analysis and visualization; this guide will provide resources to get you started with this programming language!

Assign Values to Objects

Assign values to objects using the assignment operator <-

The best practice is to use the left facing <- arrow instead of -> for ease of reading a long list of code

Tips for using <- assignments:

  • Avoid long object names                        
  • Assign a descriptive name for ease of later reference 
  • Don't use function names that already exist in R
  • Avoid using blank spaces (use underscore _ or period . instead)

For example, if you type in the Script Editor x <- 5 then, typing x + x  will output 10.