What does the lapply() function do in R?

What does the lapply() function do in R?

a) Applies a function to each element of a list and returns a list
b) Applies a function to a matrix
c) Sorts a list
d) None of the above

Answer:

a) Applies a function to each element of a list and returns a list

Explanation:

The lapply() function in R applies a specified function to each element of a list and returns the result as a list.

Reference:

R Programming – Functions MCQ Questions and Answers

Scroll to Top