The solution was a simple one.
do.call("table",X)
or
crosstabs(X)
Bill Venables gave some insight in stripping crosstabs to the bare
bones.
structure(crosstabs(~ . , X),
marginals = NULL, call = NULL, class = NULL)
I thank everyone who replied.
Ross
>I am trying to construct a contingency table of factor levels
>defined as (say 3) columns of a dataframe, X.
>table(X) gives a one dimensional table.
>apply(X,2,table) gives 3 marginal tables.
>table(X$V1,X$V2,X$V3) gives the correct answer but isn't a useful
>method for a general dataframe.
>There is obviously a simple solution, but not so obvious to me.
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news