1

How do you create a vector containing the first 5 positive even numbers in R using a loop?

Correct Answer: even_numbers <- numeric(5); for (i in 1:5) { even_numbers[i] <- 2 * i }

Make the most of this question

This page focuses on one R Programming MCQs question from Programming. After checking the answer, return to the topic list to practice more or run a timed set.