s-news
[Top] [All Lists]

[S] Summary: Arguments to table()

To: s-news@wubios.wustl.edu
Subject: [S] Summary: Arguments to table()
From: "Ross Darnell" <R.E.Darnell@newcastle.ac.uk>
Date: Mon, 29 Jun 1998 09:33:59 GMT0BST
Reply-to: R.E.Darnell@ncl.ac.uk
Sender: owner-s-news@wubios.wustl.edu
Thanks for all the replies to my query which is included below.

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

<Prev in Thread] Current Thread [Next in Thread>
  • [S] Summary: Arguments to table(), Ross Darnell <=