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.
| University Libraries
See Updates and FAQs for the latest library services updates. Subject Librarians are available for online appointments, and Virtual Reference has extended hours.

Learn R

Resources to learn and use the Open Source Statistical software R (R-Project)

Functions & Packages

Functions

() = Holds Arguments

, = Separates Arguments

readtable

Packages

Packages are groups of functions. You can't use a function until it has been both installed and loaded (or else R won't recognize the function name). 

install

Objects & Assignment

Assignment 

Create an object (or change the value) by using the arrow pointing toward the name you are giving your object (type a less than sign "<", then a dash "-"). The "type" of your new object will depend on what is on the right of the arrow.  To print the contents of your object, just type the name of the object. 

<- = Create an Object

> nine <- 9
> nine 
[1] 9
> mylist <- c("one", "two")
> 
mylist 
[1] "one"  "two"

Object Parts

For objects of type list or dataframe, you can get specific parts of the object using brackets or dollar signs. 

[] = Index

list[ element ]
> dataset[ row, column 

$ = Column Name

> dataset$column_name 

There are 4 basic concepts you need to understand:

  • Assignment
  • Objects
  • Functions
  • Packages