## 1.2 Basic Operations

Insert a new chunk using the Ctrl-Shift-I shortcut. In the new chunk, type “1+1”, excluding the quotation marks. Run this line of code. Note that when you run the line of code, R evaluates the output and prints it below the chunk, and also in the Console. You can resize the panes by clicking at the edge of a pane and dragging, for example, resizing or minimizing (button in top right of the Console pane) the Console.

Type now into the chunk, on a new line, “a <- 1+2”, again excluding the quotation marks. Run the line of code. It looks like nothing has happened, and nothing has printed below the chunk or in the console. However, in the top right pane, under the “Environment” tab, a new row should have appeared containing “a” and “3”. The environment shows any R ‘objects’. An object can be data, or a value, or a statistical model, or a function. An object is created by the assignment operator “<-”. We assigned the value of “1+1” to the object “a”. Now, if you type “a” and run that as a line of code into the chunk, you should see the number “3” appear below the chunk and in the Console.

1+1
## [1] 2
a <- 1+2
a
## [1] 3