Chapter 4 Operations and Objects

Let’s start by using R as a calculator. On your console type 3 + 3 and hit enter.

## [1] 6

Let’s save our calculation into an object, by using the assignment symbol <-.

We can treat this new object like a number

## [1] 9
## [1] 9

Look at your global enviroment in the the topright. Your object has been stored to use for the future. Clearing the enviroment will delete all objects in the enviroment.

You can also make a vector that hold multiple numbers. Suppose you need to create a vector of dogs ages for 5 dogs. This can be accomplished in the following code.

Then we can multiply all of the elements of a vector (if all elements are numeric). Below we can see how old each dog is in human years.

## [1] 35 21 49 14  7

4.0.1 Challenge

Create a vector of peoples jobs experience with 1,4,6,2,3 and 8 years. Let say if everyone starts out making $60,000 and $5,000 for every year of expirence. How much money is each person curently making?