adplus-dvertising
frame-decoration

Question

What will be the output of the following R code?
> x <- list(a = matrix(1:4, 2, 2), b = matrix(1:6, 3, 2))
> lapply(x, function(elt) { elt[,1] })

a.

$a
[1] 1 2
$b
[1] 1 2 3

b.

$a
[1] 1 2 3
$b
[1] 1 2 3

c.

$a
[1] 1 2 3
$b
[1] 1 2

d.

Error

Answer: (a).$a
[1] 1 2
$b
[1] 1 2 3

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What will be the output of the following R code?