I also don't like to use split function because I have like around 800 columns 

Date: Thu, 22 Nov 2012 18:08:54 -0800
From: ml-node+s789695n4650496...@n4.nabble.com
To: frespi...@hotmail.com
Subject: RE: Summary statistics for matrix columns

Hi,

How about this:

res<-do.call(cbind,lapply(split(x,col(x)),function(x) 
c(summary(x),sd=sd(x),IQR=IQR(x))))

 colnames(res)<-colnames(x)

 is.matrix(res)

[1] TRUE

 res

            Col1     Col2     Col3     Col4     Col5     Col6     Col7     Col8

Min.    10.00000  1.00000 17.00000  3.00000 18.00000 11.00000 13.00000 15.00000

1st Qu. 24.75000 29.50000 26.00000  7.75000 40.00000 17.25000 27.50000 34.75000

Median  34.00000 46.00000 42.50000 35.50000 49.50000 23.50000 51.50000 51.50000

Mean    42.50000 42.75000 41.75000 35.75000 44.88000 26.88000 44.75000 50.12000

3rd Qu. 67.75000 58.50000 50.00000 63.25000 54.25000 30.25000 56.25000 70.50000

Max.    74.00000 77.00000 76.00000 70.00000 65.00000 63.00000 79.00000 80.00000

sd      25.05993 27.77846 19.57221 28.40397 16.39196 16.60841 21.97239 25.51995

IQR     43.00000 29.00000 24.00000 55.50000 14.25000 13.00000 28.75000 35.75000

            Col9    Col10

Min.     2.00000  6.00000

1st Qu. 24.50000 12.50000

Median  33.50000 48.00000

Mean    34.88000 40.75000

3rd Qu. 45.25000 63.00000

Max.    71.00000 72.00000

sd      24.39811 28.21727

IQR     20.75000 50.50000

A.K.

        
        
        





If you reply to this email, your message will be added to the discussion below:
http://r.789695.n4.nabble.com/Summary-statistics-for-matrix-columns-tp4650489p4650496.html


This email was sent by arun kirshna (via Nabble)


                                          



--
View this message in context: 
http://r.789695.n4.nabble.com/Summary-statistics-for-matrix-columns-tp4650489p4650498.html
Sent from the R help mailing list archive at Nabble.com.
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to