s-news
[Top] [All Lists]

[S]: Arguments to table()

To: s-news@wubios.wustl.edu
Subject: [S]: Arguments to table()
From: "Ross Darnell" <R.E.Darnell@newcastle.ac.uk>
Date: Thu, 25 Jun 1998 12:00:10 GMT0BST
Reply-to: R.E.Darnell@ncl.ac.uk
Sender: owner-s-news@wubios.wustl.edu
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.

Thanks in advance

Ross Darnell
-----------------------------------------------------------------------
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>