What does the rep() function do in R?

What does the rep() function do in R?

a) Repeats a value or vector
b) Returns the average of a vector
c) Removes duplicates from a vector
d) Returns the reverse of a vector

Answer:

a) Repeats a value or vector

Explanation:

The rep() function repeats a value or a vector a specified number of times in R.

Reference:

R Programming – Functions MCQ Questions and Answers

Scroll to Top