Practicing Assignment and Data Types

  1. Create a variable called my_age and set it equal to your age

  2. Check the class of my_age using the class() function.

  3. Create a variable called my_dog and set it equal to the name of your dog. (If you do not have a dog, pretend you do What’s your pretend dog’s name?)

  4. What’s the class of my_dog?

  5. Now the weird one. Create a variable called seven and assign in the value "7" in quotes. What’s the class of 7? Why is it not numeric?

  6. What happens if you add my_age and seven?

  7. To convert seven to a numeric type, type seven = as.numeric(seven). Now check it’s class again.

  8. Now can you add my_age to seven?