[R] summary for factors is not very informative

Thomas Lumley tlumley at uw.edu
Wed Feb 16 02:28:21 CET 2011


It does print frequency stats, just not all of them.  The reason it
doesn't print all of them is that there could be thousands of them.
If you want a table, use table()

     -thomas

On Wed, Feb 16, 2011 at 11:31 AM, Sam Steingold <sds at gnu.org> wrote:
> summary() for a factor prints:
>
>     ColName
>  SNDK  :  72
>  VXX   :  36
>  MWW   :  30
>  ACI   :  28
>  FRO   :  28
>  (Other):1801
>
> it would have been much more useful if it additionally
> printed frequency stats as if by
> summary(aggregate(frame$ColName,by=list(frame$ColName),FUN=length)$x)
>
> --
> Sam Steingold (http://sds.podval.org/) on CentOS release 5.3 (Final)
> http://jihadwatch.org http://www.PetitionOnline.com/tap12009/
> http://camera.org http://honestreporting.com http://openvotingconsortium.org
> Abandon all hope, all ye who press Enter.
>
> ______________________________________________
> 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.
>



-- 
Thomas Lumley
Professor of Biostatistics
University of Auckland



More information about the R-help mailing list