David, I use CrossTable, so that was my first guess. It'll do proportions/percents by row, column or total in a 2-way table. For 1-way tables, it still tries looks like a 2-way table, unless you specify max.width=1. Then it does one column, but no cumulative proportions (see below).
I appreciate the idea though! Thanks, Bob > CrossTable(Score, max.width=1) Cell Contents |-------------------------| | N | | N / Table Total | |-------------------------| Total Observations in Table: 1000 | 70 | |-----------| | 44 | | 0.044 | |-----------| | 71 | |-----------| | 42 | | 0.042 | |-----------| | 72 | |-----------| | 40 | | 0.040 | |-----------| | 73 | |-----------| | 40 | | 0.040 | |-----------| | 74 | |-----------| | 43 | | 0.043 | |-----------| | 75 | |-----------| | 45 | | 0.045 | |-----------| | 76 | |-----------| | 46 | | 0.046 | |-----------| | 77 | |-----------| | 40 | | 0.040 | |-----------| | 78 | |-----------| | 46 | | 0.046 | |-----------| | 79 | |-----------| | 43 | | 0.043 | |-----------| ... -----Original Message----- From: David Scott [mailto:d.sc...@auckland.ac.nz] Sent: Friday, October 16, 2009 8:42 PM To: Muenchen, Robert A (Bob) Cc: ted.hard...@manchester.ac.uk; r-help@r-project.org Subject: Re: [R] Frequencies, proportions & cumulative proportions Muenchen, Robert A (Bob) wrote: > Ted, > > I know how to do that. It's just such a standard display in SAS, SPSS > and Stata that I figured someone had done it and I had just overlooked > it. > > Thanks! > Bob > > > > I don't think there is a ready-made one, but it is very little > effort to make your own: > > mkMyTable <- function(X){ > Table <- data.frame( table(X) ) > Table$Prop <- prop.table( Table$Freq ) > Table$CumProp <- cumsum( Table$Prop ) > Table > } > > myTable <- mkMyTable(Score) > > Hoping this helps! > Ted. > I think CrossTable in gmodels does what Bob is after: CrossTable(gmodels) R Documentation Cross Tabulation with Tests for Factor Independence Description An implementation of a cross-tabulation function with output similar to S-Plus crosstabs() and SAS Proc Freq (or SPSS format) with Chi-square, Fisher and McNemar tests of the independence of all table factors. David Scott -- _________________________________________________________________ David Scott Department of Statistics The University of Auckland, PB 92019 Auckland 1142, NEW ZEALAND Phone: +64 9 923 5055, or +64 9 373 7599 ext 85055 Email: d.sc...@auckland.ac.nz, Fax: +64 9 373 7018 Director of Consulting, Department of Statistics ______________________________________________ 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.