A margin, which, which we'll get to in a second.

This is a vector, an integer vector that indicates which margin should be retained.

And the last important argument is the function that you want to apply to each

of the margins.

So, and then the dot dot dot argument are other arguments that

you want to pass, include other arguments that you want to pass to the function.

So here's a matrix that I'm creating, it has 20 rows and ten columns.

so, in, in, in the matrix it's just normal random variables that I've generated.

So when I apply, so what I want to do is, I want to take

this matrix and I want to calculate the mean of each column of the matrix.

So the way I can do this

is I can apply, use the apply function on x.

I give it the margin, two, and I'll say what that means in a second.

And I pass the function, mean.

And so what happens is, I get back a vector of length

ten that has the mean of each of the columns of the matrix.

And so the idea is that, so the matrix has ten, sorry, it has 20

rows and ten columns, and so that you can think of the matrix as, as, and so

dimension one has 20 rows and dimension two has ten columns.

So, when you apply the function, mean, over the

matrix, well, the idea is that you want to keep the

second dimension, which is the number of columns, and

you want to collapse the first dimension, which is the rows.

So that, so the idea is that you're taking the

mean across all the rows in each column, and then

you're, and you're essentially limiting the, the rows from the

array, so what you get back is actually has the,

has one of the dimensions has been eliminated.

It's really the first dimension that's been eliminated.

And so you get this number which this vector which

has each of the means for each of the columns.

similarly, you can take the means of all the rows of the array.

And I can, I can call the apply function on x.

I give it the dimens, the margin, one, which

means preserve all the rows, but collapse all the columns.

And then I, I, here I'm calculating the sum

of each the rows, instead of the mean.

So the, so, I cast the one because it says I want to, I, because

of what I mean is I want to preserve the rows and collapse the columns.

So here, I got a vector of 20, because there's 20 rows.

And each, and inside each and for each row, I calculate the sum of that row.