Chapter 4: The Basics
- Which (if any) of the following objects names is/are invalid?
thisone <- 1
THISONE <- 2
1This <- 3
this.one <- 3
This.1 <- 4
ThIS.....ON...E <- 5
This!One! <- 6 # only this one!
lkjasdfkjsdf <- 7
- 2015 was a good year for pirate booty - your ship collected 100,000 gold coins. Create an object called and assign the correct value to it.
- 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.
gold.in.2015 <- gold.in.2015 + 800
plank.list <- "Skippy McGee"
- 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
a # It will return 10 because we never re-assigned a!