4.5 Test your R might!

  1. Create a new R script. Using comments, write your name, the date, and “Testing my Chapter 2 R Might” at the top of the script. Write your answers to the rest of these exercises on this script, and be sure to copy and paste the original questions using comments! Your script should only contain valid R code and comments.

  2. Which (if any) of the following objects names is/are invalid?

thisone <- 1
1This <- 3
this.one <- 4
This.1 <- 5
ThIS.....ON...E <- 6
This!On!e <- 7
lkjasdfkjsdf <- 8
  1. 2015 was a good year for pirate booty - your ship collected 100,800 gold coins. Create an object called gold.in.2015 and assign the correct value to it.

  2. Oops, during the last inspection we discovered that one of your pirates Skippy McGee hid 800 gold coins in his underwear. Go ahead and add those gold coins to the object gold.in.2015. Next, create an object called plank.list with the name of the pirate thief.

  3. Look at the code below. What will R return after the third line? Make a prediction, then test the code yourself.

a <- 10
a + 10