apply() is a R function which enables to make quick operations on matrix, vector or array. The operations can be done on the lines, the columns or even both of them.
Example: Execute a given function to the rows (index 1) or column (index 2)of a matrix or an array. [apply(x,2,sum].