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

Hương Trang

New member
What will be the output of the following R code?
Code:
> x <- list(a = matrix(1:4, 2, 2), b = matrix(1:6, 3, 2))
> lapply(x, function(elt) { elt[,1] })
A.
Code:
$a
[1] 1 2
$b
[1] 1 2 3
B.
Code:
$a
[1] 1 2 3
$b
[1] 1 2 3
C.
Code:
$a
[1] 1 2 3
$b
[1] 1 2
D. Error
 

Tìm kiếm

Back
Top