Step 1, creates a matrix and generates the row minimums for it:
- The first argument for apply is a matrix or array.
- The second argument (called margin) specifies how we want to split the matrix or array into pieces. For a two-dimensional structure, we can operate on rows as 1, columns as 2, or elements as c(1,2). For matrices of more than two dimensions, margin can be more than two and specify the dimension(s) of interest (see the There's more... section).
- The third argument is a built-in or custom function. In fact, we can even specify an unnamed function in-line, as step 3 shows.
The apply function invokes the specified function with each row, column, or element of the matrix, depending on the second argument.
The return ...