What does the apply() function do in R?

What does the apply() function do in R?

a) Applies a function over rows or columns of an array or matrix
b) Removes missing values from a vector
c) Sorts a vector
d) Combines two vectors

Answer:

a) Applies a function over rows or columns of an array or matrix

Explanation:

The apply() function applies a specified function to the rows or columns of a matrix or array in R.

Reference:

R Programming – Functions MCQ Questions and Answers

Scroll to Top