Solution Review: Variables
Explore how to determine the data types of variables in R by using class() to find high-level types and typeof() for underlying types. This lesson guides you through printing these details with cat() to understand R variables and their basic operations.
We'll cover the following...
We'll cover the following...
Solution: Use class() and typeof()
Explanation
The first task we were given was to find the high-level data type of the given testVariable. We can do this by using the class() function with the given testVariable. The second task was to print the low-level data type of the testVariable and for that, we use the typeof() function with the testVariable.
A function is a set of instructions that perform a task. We will learn more about functions later in the course.
We pass both these functions to cat() for printing.