Krishna Kirti Das
2011-Jan-08 07:07 UTC
[R] summary(list) is awesome, but I want more than summary
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
Duncan Murdoch
2011-Jan-08 08:23 UTC
[R] summary(list) is awesome, but I want more than summary
On 11-01-08 2:07 AM, Krishna Kirti Das wrote:> 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. >summary(mydata, maxsum=Inf) should work. See ?summary for other options. Duncan Murdoch> I shall be obliged. > > All the best, > > KKD > > ______________________________________________ > R-help at 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.