Din't you try sapply function?
I tried it for you.
Just convert your matrix into a data frame using as.data.frame and then
*> rantony*
ABC PQR XYZ MNO
[1,] 3 6 7 15
[2,] 2 12 24 15
[3,] 20 5 1 2
[4,] 25 50 15 35
*> rantony=as.data.frame(rantony)*
*> sapply(rantony,var)* #calculates column wise variance
ABC PQR XYZ MNO
137.66667 457.58333 99.58333 185.58333
*> sapply(rantony,Mode)* #calculates column vise Mode, where the mode
function is available in
http://cran.r-project.org/web/packages/prettyR/index.html prettyR package
ABC PQR XYZ MNO
">1 mode" ">1 mode" ">1 mode" "15"
# the above means there are no modes in first three columns and in the last
column Mode is 15