Recall & Review
beginner
What is a vector in R?
A vector in R is a basic data structure that holds elements of the same type in a sequence. It is like a row of boxes where each box holds one item, and all items are of the same kind.
Click to reveal answer
beginner
Why are vectors considered fundamental in R?
Vectors are fundamental because all other data structures in R, like matrices, lists, and data frames, are built on top of vectors. They provide a simple and efficient way to store and manipulate data.
Click to reveal answer
intermediate
How does R handle different types of data in vectors?
R vectors can only hold one type of data at a time (numeric, character, logical, etc.). If you mix types, R will convert them to a common type to keep the vector consistent.
Click to reveal answer
beginner
What happens if you combine numbers and characters in a vector?
R converts all elements to characters because character is a more general type. This process is called type coercion.
Click to reveal answer
intermediate
How do vectors improve performance in R?
Vectors allow R to store data in a contiguous block of memory, making data access and operations faster and more efficient compared to other data structures.
Click to reveal answer
What type of elements can a vector in R hold?
✗ Incorrect
Vectors in R hold elements of the same type. If different types are combined, R coerces them to a common type.
Which data structure is NOT built on vectors in R?
✗ Incorrect
Functions are not built on vectors. Data frames, matrices, and lists are built using vectors.
What happens when you combine numeric and character data in a vector?
✗ Incorrect
R coerces all elements to characters to keep the vector consistent.
Why are vectors efficient in R?
✗ Incorrect
Continuous memory storage allows faster data access and operations.
Which of these is a characteristic of vectors in R?
✗ Incorrect
Vectors are the foundation for other data structures like matrices and data frames.
Explain why vectors are the fundamental data structure in R.
Think about how R organizes data and builds complex structures.
You got /4 concepts.
Describe what happens when you mix different data types in a vector.
Consider how R keeps vectors uniform.
You got /4 concepts.