Which of the following can be used to loop through a vector in R?

Which of the following can be used to loop through a vector in R?

a) for loop
b) while loop
c) repeat loop
d) All of the above

Answer:

d) All of the above

Explanation:

All types of loops (for, while, and repeat) can be used to iterate through a vector in R, depending on the use case.

Reference:

R Programming – Loops MCQ Questions and Answers

Scroll to Top