1. Data types. You are given a bond dataset that contains four variables: rate, rating, default, and company. Check the data type of each of these
variables using the function class().
rate <- c(11.05, 3.01)
rating <- c("C","AA")
default <- c(TRUE, FALSE)
company <- c("Reckless_Corp", "Cautious_Corp")
# Check the data type of company.
class(company)
# Check the data type of rate.
class(___)
# Check the data type of rating.
___(rating)
# Check the data type of default.
____
# Check the data type of company.
class(company)
# Check the data type of rate.
class(rate)
# Check the data type of rating.
class(rating)
# Check the data type of default.
class(default)
test_error()
test_function("class")
success_msg("Well done! Did the types match your expectations? If not, try printing the variables in the console using print().")
Use the class() function to check a variable's data type.