Recall & Review
beginner
What is a data type in R?
A data type in R tells us what kind of data a value holds, like numbers, text, or true/false. It helps R know how to use the data.
Click to reveal answer
beginner
Why does R need to know data types?
R needs data types to decide how to store data and what operations can be done, like adding numbers or joining text.
Click to reveal answer
intermediate
What happens if you mix data types in R vectors?
R will convert all elements to the same type, usually to the most flexible type, like turning numbers into text if mixed with characters.
Click to reveal answer
intermediate
How do data types affect functions in R?
Functions expect certain data types. If you give the wrong type, the function might give errors or wrong results.
Click to reveal answer
beginner
Name some common data types in R.
Common data types in R include numeric (numbers), character (text), logical (TRUE/FALSE), and factor (categories).
Click to reveal answer
What data type does R convert to when mixing numbers and text in a vector?
✗ Incorrect
When mixing numbers and text, R converts all elements to character to keep data consistent.
Which data type in R represents TRUE or FALSE values?
✗ Incorrect
Logical data type holds TRUE or FALSE values.
Why is it important to know data types before using a function in R?
✗ Incorrect
Functions expect specific data types to work correctly.
Which of these is NOT a common data type in R?
✗ Incorrect
R uses 'Logical' for TRUE/FALSE, not 'Boolean'.
What does R do if you try to combine numeric and logical values in a vector?
✗ Incorrect
R converts logical values to numeric (TRUE to 1, FALSE to 0) when combined.
Explain why understanding data types is important when working with R.
Think about how R treats different kinds of data and what happens if types don't match.
You got /4 concepts.
Describe what happens when you mix different data types in an R vector.
Remember R wants all elements in a vector to be the same type.
You got /3 concepts.