[R] summary(list) is awesome, but I want more than summary

Krishna Kirti Das krishnakirti at gmail.com
Sat Jan 8 08:07:03 CET 2011


When I load a table from a data source and run summary() on it, the
summary gives me basic summary statistics I'm looking for, and it also
discriminates between quantitative and qualitative data and summarizes
them accordingly. For example, if I do this:

     mydata <- read.table("data.txt")
     summary(mydata)

I would get output like this:


> summary(mydata)
        County
 BERNALILLO:2863
 DONA ANA  : 772
 SANTA FE  : 671
 SANDOVAL  : 579
 SAN JUAN  : 471
 VALENCIA  : 281
 (Other)   :2863

   Votemode2010
  Min.   : 1.000
  1st Qu.: 3.000
  Median : 4.000
  Mean   : 3.942
  3rd Qu.: 5.000
  Max.   : 6.000
  NA's   :11.000

Notice how for the first table the summary simply reports the
frequencies of the qualitative data and in the second table it gives
me a five-number summary for the quantitative data.

Now, here is what I'm looking for. I like how the summary function
dumps either frequency summary or a five number summary depending on
what the data is, but what I really would like is something like what
summary does for the quantitative data, but that it gives me the
frequency for all the rest of the values "(Other)" not reported in the
summary. In other words, how do I make the summary function give me
not a summary but everything? I would like all frequencies, not just
the top five.

I shall be obliged.

All the best,

KKD



More information about the R-help mailing list