10 Things about R to get you started:

1. History of R

R is a dialect of the S language that was written by John Chambers and others at Bell Labs in the 70s. In the 90s, R was developed and made available to the public with the GNU general public license. Importantly, R is free, meaning that you don’t have to pay for it (duh), but that you have freedom to use and modify it.

2. Installing and Starting

Go to http://cran.r-project.org.

When R starts it loads some infrastructure and provides you with a prompt: >

This prompt is the fundamental entry point for communicating with R. We type expressions at the prompt, R evaluates these expressions, and returns output.

3. Objects in R

R is “object-oriented” meaning that we can create objects that persist within an R session and they can be manipulated.

We create objects by using the assignment operator: <-

What you type on the right is assigned to what you type on the left. For example:
y <- 4 (we have assigned the value 4 to the object y)
x <- 6 (we have assigned the value 6 to the object x)
z <- y (we have assigned the value of the object y to the object z, i.e. z = 4)

After assigning a value to an object, enter the name of the object to see what the value is.

Variables can start with a letter, digits, or periods. Pretty much anything. Just not a number by itself.
Some examples (the second one does not work):
the.number.two <- 2
2 <- the.number.two

R is case sensitive (i.e. A is a different object than a). R is insensitive to white space though.
These two examples are treated the same in R:
x <- 2
x<- 2

To have R ignore text, use the # sign to make comments.
For example: x <- 2 # this assigns the value 2 to object x.

4. Functions in R

A major strength of R is the ability to manipulate objects using functions. A function takes an argument (aka input) and returns some value (aka output).

For example, suppose we wanted to create a list of numbers, called a vector. We want to create an object that is defined by the list of numbers. In R, there is a preprogrammed function c(), which combines or concatenates values to create a single object. We can create an object x, that is a vector of 1, 2, 3, 4, and 5 using: x <- c(1,2,3,4,5).

This reads: the object x is assigned the values 1, 2, 3, 4, and 5. The function is “c” and the argument is 1,2,3,4,5.

The number of values (aka elements) a vector contains is referred to as the “length”. We can use the length() function to return this information for us. For example: length(x) shows that the vector x has 5 values or elements.