Complete the code to create a named vector with names 'a', 'b', 'c'.
vec <- c(1, 2, 3) names(vec) <- [1]
Use c('a', 'b', 'c') to assign names to the vector elements.
Complete the code to access the element named 'b' from the named vector.
vec <- c(x=10, y=20, b=30) value <- vec[[1]]
Use the name in quotes to access the element by name: vec["b"].
Fix the error in the code to correctly assign names to the vector.
vec <- c(5, 10, 15) names(vec) <- [1]
The names vector must have the same length as vec. Here, c('first', 'second', 'third') matches length 3.
Fill both blanks to create a named vector and access the element named 'green'.
colors <- c([1]) names(colors) <- c('red', 'green', 'blue') value <- colors[[2]]
c() to create the vector.Use c(5, 10, 15) to create the vector and "green" to access the named element.
Fill all three blanks to create a named vector, assign names, and access the element named 'second'.
vals <- [1] names(vals) <- [2] result <- vals[[3]]
Create the vector with c(100, 200, 300), assign names with c('first', 'second', 'third'), and access the element named "second".