Practicing Assignment and Data Types¶
Create a variable called
my_age
and set it equal to your ageCheck the class of
my_age
using theclass()
function.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?)What’s the class of
my_dog
?Now the weird one. Create a variable called
seven
and assign in the value"7"
in quotes. What’s the class of7
? Why is it not numeric?What happens if you add
my_age
andseven
?To convert
seven
to a numeric type, typeseven = as.numeric(seven)
. Now check it’s class again.Now can you add
my_age
toseven
?