What Will Be The Output Of The Following R Codep Pre Langrsplus #348
What will be the output of the following R code?</p> <pre><code class="language-rsplus"> > x <- list(a = matrix(1:4, 2, 2), b = matrix(1:6, 3, 2)) > lapply(x, function(elt) { elt[,1] }) </code></pre>
This multiple choice question (MCQ) is related to the book/course gs gs110 R Language. It can also be found in gs gs110 Control Structures, Functions, Scoping Rules, Loop Functions and Debugging - Control Structures - Quiz No.2.
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 [1] 1 2 $b [1] 1 2 3
$a [1] 1 2 3 $b [1] 1 2 3
$a [1] 1 2 3 $b [1] 1 2
Error