Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Which of the following code extracts 1st element of the 2nd element?
> x < – list(a = list(10, 12, 14), b = c(3.14, 2.81))

Which of the following code extracts 1st element of the 2nd element?
> x < - list(a = list(10, 12, 14), b = c(3.14, 2.81))
a) x[[c(2, 1)]]
b) x[[c(1, 2)]]
c) x[[c(2, 1,1)]]
d) x[[(2, 2,1)]]

Answer: a
Explanation: [ operator always returns an object of the same class as the original.

Join The Discussion