Recall & Review
beginner
What does the
c() function do in R?The
c() function combines values into a vector, which is a basic data structure in R that holds elements of the same type.Click to reveal answer
beginner
How do you create a numeric vector with the numbers 1, 2, and 3 using
c()?You write
c(1, 2, 3). This creates a vector containing the numbers 1, 2, and 3.Click to reveal answer
intermediate
Can
c() combine different types like numbers and characters in one vector?Yes, but R will convert all elements to the most flexible type to keep the vector consistent. For example, combining numbers and characters will convert numbers to characters.
Click to reveal answer
beginner
What happens if you use
c() with no arguments?It creates an empty vector with no elements.
Click to reveal answer
intermediate
How does
c() differ from other vector creation functions like seq() or rep()?c() combines specific values you list, while seq() creates sequences of numbers and rep() repeats values. c() is for manual combination.Click to reveal answer
What does
c(4, 5, 6) create in R?✗ Incorrect
c() creates a vector combining the values 4, 5, and 6.What type will the vector
c(1, "a", TRUE) have?✗ Incorrect
R converts all elements to character because it is the most flexible type among numeric, logical, and character.
What is the result of
c() with no arguments?✗ Incorrect
Calling
c() without arguments returns an empty vector.Which function is best to create a vector repeating the number 3 five times?
✗ Incorrect
rep(3, 5) repeats the number 3 five times efficiently.If you want to combine the numbers 1, 2, and 3 into a vector, which is correct?
✗ Incorrect
c(1, 2, 3) is the correct way to combine values into a vector.Explain how the
c() function works to create vectors in R.Think about how you put things together in a row.
You got /4 concepts.
Describe what happens when you mix numbers and characters inside
c().Consider how R keeps things consistent.
You got /3 concepts.