[R] Newbie cross tabulation issue

Marc Schwartz marc_schwartz at me.com
Thu Sep 9 19:30:46 CEST 2010


On Sep 9, 2010, at 12:16 PM, David Winsemius wrote:

> 
> On Sep 9, 2010, at 11:20 AM, David Winsemius wrote:
> 
>> 
>> On Sep 8, 2010, at 7:32 PM, Jonathan Finlay wrote:
>> 
>>> Thanks David, gmodels::Crosstable partially work because can show only 1 x 1
>>> tablen
>>> CrossTable(x,y,...)
>>> I need something how can process at less 1 variable in X an 10 in Y.
>> 
>> A further thought (despite a lack of clarification on what your data situation really is.). The strong tendency in R is not to attempt replication of formats in SAS that were developed in an era of dot-matrix printers, but to target modern output devices. As such most of the table output facilities with any degree of sophistication have LaTeX or HTML as targets.
>> 
>> RSiteSearch("html tables") produces over 1000 links although they have many that are not for multiway tables where "multi" is greater than R x C. RSiteSearch("latex tables") produces many fewer.  You may want to look at xtable, Sweave, odfWeave, the various HTML utilities, and Harrell's Hmisc::summary.formula
> 
> Perhaps my final thought. It has none of the dividing lines, but "ftable" is the standard method for displaying "flat" contingency tables for greater than two dimensions. Try the examples on the help page. If you wanted to add all that "+---+"-ing window dressing you could concievable start with its code using:
> 
> getAnywhere(ftable.default)
> 
> .... and stick in the needed cat() statements. You can see how the author of CrossTables proceeded by just typing the function name without quotes:
> 
> CrossTables
> 
> -- 
> David.


One additional comment, which is that Jakson Aquino took over the enhancement and maintenance of the original CrossTable() function about a year ago. That is now in his 'descr' package on CRAN, even though the earlier version is still present in 'gmodels'. I have not used the function myself in a number of years and Jakson volunteered via offlist communications to take it on in order to introduce some enhancements, including the further separation of a print method for the function. I don't know how far along he is in the process, so it may take some further investigation.

HTH,

Marc Schwartz



More information about the R-help mailing list