gs gs110 Control Structures, Functions, Scoping Rules, Loop Functions and Debugging - Control Structures - Quiz No.2
gs gs110 R Language Quiz
This quiz belongs to book/course code gs gs110 R Language of gs organization. We have 87 quizzes available related to the book/course R Language. This quiz has a total of 10 multiple choice questions (MCQs) to prepare and belongs to topic Control Structures, Functions, Scoping Rules, Loop Functions and. NVAEducation wants its users to help them learn in an easy way. For that purpose, you are free to prepare online MCQs and quizzes.
NVAEducation also facilitates users to contribute in online competitions with other students to make a challenging situation to learn in a creative way. You can create one to one, and group competition on an topic of a book/course code. Also on NVAEducation you can get certifications by passing the online quiz test.
> x <- list(a = 1:4, b = rnorm(10), c = rnorm(20, 1), d = rnorm(100, 5)) > lapply(x, mean)
$a [1] 2.5 $b [1] 1.248845 $c [1] 1.9935285 Loop Functions 90 $d [1] 5.051388
$a [1] 2.5 $b [1] 0.248845 $c [1] 0.9935285 Loop Functions 90 $d [1] 5.051388
$a [1] 3.5 $b [1] 0.248845 $c [1] 0.9935285 Loop Functions 90 $d [1] 5.051388
> x <- 1:4 > lapply(x, runif)
[[1]] [1] 0.02778712 [[2]] [1] 0.5273108 0.8803191 [[3]] [1] 0.37306337 0.04795913 0.13862825 [[4]] [1] 0.3214921 0.1548316 0.1322282 0.2213059
[[1]] [1] 1.02778712 [[2]] [1] 2.5273108 0.8803191 [[3]] [1] 3.37306337 0.04795913 0.13862825 [[4]] [1] 0.3214921 0.1548316 0.1322282 0.2213059
[[1]] [1] 1.02778712 [[2]] [1] 0.5273108 0.8803191 [[3]] [1] 0.37306337 0.04795913 0.13862825 [[4]] [1] 3.3214921 2.1548316 1.1322282 0.2213059
[[1]] [1] 2.263808 [[2]] [1] 1.314165 9.815635 [[3]] [1] 3.270137 5.069395 6.814425 [[4]] [1] 0.9916910 1.1890256 0.5043966 9.2925392
> x <- 1:4 > lapply(x, runif, min = 0, max = 10)
> x <- 1:4 > lapply(x, runif, min = 0, max = 9)
> x <- 1:3 > lapply(x, runif, min = 0, max = 10)
> x <- 1:4 > lapply(x, runif, min = 0, max = 6)
> 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
> f <- function(elt) { + elt[, 1] + } > lapply(x, f)
$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
> x <- list(a = 1:4, b = rnorm(10), c = rnorm(20, 1), d = rnorm(100, 5)) > sapply(x, mean)
a b c d 2.500000 -0.251483 1.481246 4.968715
a b c d 2.500000 -3.251483 2.481246 5.968715
a b c d 3.500000 0.251483 1.481246 4.968715