Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a vector with numbers 1, 2, and 3.
R Programming
vec <- [1](1, 2, 3)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using list() instead of c()
Using vector() without specifying type
✗ Incorrect
The c() function combines values into a vector.
2fill in blank
mediumComplete the code to create a character vector with elements "apple", "banana", and "cherry".
R Programming
fruits <- [1]("apple", "banana", "cherry")
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using list() which creates a list, not a vector
✗ Incorrect
The c() function creates a vector of characters here.
3fill in blank
hardFix the error in the code to create a numeric vector with 4, 5, and 6.
R Programming
numbers <- [1](4, 5, 6)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using list() which creates a list, not a vector
✗ Incorrect
The c() function correctly creates a numeric vector.
4fill in blank
hardFill both blanks to create a vector of logical values TRUE and FALSE.
R Programming
logical_vec <- [1](TRUE, [2])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using list() instead of c()
Using TRUE twice
✗ Incorrect
The c() function combines logical values TRUE and FALSE into a vector.
5fill in blank
hardFill all three blanks to create a vector with elements 10, 20, and 30.
R Programming
vec <- [1]([2], [3], 30)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using list() instead of c()
Swapping the order of numbers
✗ Incorrect
The c() function combines the numbers 10, 20, and 30 into a vector.