Apply Family

Apply function

R code with apply function

Lapply

lapply is similar to apply, but it takes a list as an input and return list as an output.
Also every elements in the list can have different size.

R code for lapply

We have to Create a list first:

Sapply

R-code for sapply

# Similarly we can apply other functions also.

tapply

Mapply