[Solved] How to found the mean of column in a matrix in R [closed]


Why not extract that column and take the mean??

> m <- matrix(1:10, nrow=5)
> mean(m[,1]) # mean of the first column
[1] 3

# mean of the second column conditional on values of column 3 are bigger than 4
> mean(x[x[,3]>4,2]) 
[1] 5

I don’t understand what you mean with “…second column where the first row numbers are bigger than 2 …” Anyway take a look at ?"[ for learning how to subset a matrix and extract values from it.

3

solved How to found the mean of column in a matrix in R [closed]