[18996] in s-news-athena

home help back first fref pref prev next nref lref last post

[S] Date: Sat, 21 Aug 1999 12:45:01 +0800

daemon@ATHENA.MIT.EDU (Abd Rahman Kassim)
Sat Aug 21 00:50:04 1999

Date: Fri, 20 Aug 1999 23:46:33 -0500 (CDT)
Message-Id: <01BEEBD2.FD100E60@ABDRAHMA>
From: Abd Rahman Kassim <rahmank@frim.gov.my>
To: "s-news@wubios.wustl.edu" <s-news@wubios.wustl.edu>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 8bit


Dear S-plus users,

Thank for your prompt reply. Both solution solve my problem.

Stated below are the response to my earlier question.

Solution 1:

ans <- lapply(levels(V1), function(x)table(V2[V1==x], V3[V1==x]))
(V1, V2 and V3 are the names of the 3 variables.)
If you want to label the elements of the resulting list according to the
levels of V1, you can use
names(ans) <- levels(V1)

Solution 2:

* table(v1,v2,v3) 



Dear S-Plus users,

I have a set of data with three categorical variable. I would like to summaries the first two variable in tabular form for each category in the third variable.  
I have tried the table functions :   
table (variable 1[variable 3== "a"], variable 2 [variable 3== "a"])
It works for one category of the third variable one at a time. How can I run the table function for each category in variable 3 in one run. 
Any helps appreciated.

Abd Rahman Kassim
Hill Forest Silviculture
FRIM



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

home help back first fref pref prev next nref lref last post