[19002] in s-news-athena

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

[S] Date: Mon, 23 Aug 1999 08:45:49 +0800

daemon@ATHENA.MIT.EDU (Abd Rahman Kassim)
Sun Aug 22 20:55:35 1999

Date: Sun, 22 Aug 1999 19:47:14 -0500 (CDT)
Message-Id: <01BEED43.E7606AC0@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