Complete the code to exclude the second element from the vector.
vec <- c(10, 20, 30, 40) result <- vec[[1]] print(result)
Using -2 excludes the second element from the vector.
Complete the code to exclude the first and third elements from the vector.
vec <- c(5, 15, 25, 35) result <- vec[[1]] print(result)
Using -c(1, 3) excludes the first and third elements from the vector.
Fix the error in the code to exclude the last element from the vector.
vec <- c(2, 4, 6, 8) result <- vec[[1]] print(result)
Using -length(vec) excludes the last element by negative indexing with the vector length.
Fill both blanks to exclude the second and fourth elements from the vector.
vec <- c(3, 6, 9, 12, 15) result <- vec[[1]([2])] print(result)
Using -c(2, 4) excludes the second and fourth elements from the vector.
Fill all three blanks to exclude the first, third, and fifth elements from the vector.
vec <- c(7, 14, 21, 28, 35, 42) result <- vec[[1]([2])] print(result) # The excluded elements are [3].
Using -c(1, 3, 5) excludes the first, third, and fifth elements, which are 7, 21, and 35.
