What does loop function signifies in R



while studying I came across to four loop function
I want to know what each loop function means and where to use them


see here


lapply returns a list of the same length as X, each element of which is the result of applying FUN to the corresponding element of X.

sapply is a user-friendly version and wrapper of lapply by default returning a vector, matrix or, if simplify = “array”, an array if appropriate, by applying simplify2array(). sapply(x, f, simplify = FALSE, USE.NAMES = FALSE) is the same as lapply(x, f).

vapply is similar to sapply, but has a pre-specified type of return value, so it can be safer (and sometimes faster) to use.

also see here


The R manuals are indeed helpful but you can find some very good examples here:

and here:

Hope this helps!