s-news
[Top] [All Lists]

Function for summarizing the table to two factors and a frequency

To: "s-news@lists.biostat.wustl.edu" <s-news@lists.biostat.wustl.edu>
Subject: Function for summarizing the table to two factors and a frequency
From: Jagadish Rangrej <jrangrej@yahoo.com>
Date: Wed, 7 Dec 2005 14:16:54 -0800 (PST)
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=QCTBznqMXb3Ua9K/Niq7b6gEDnokknTGaM9BhTtzqMUOikesYdH0XdLdgvhkCeNImARsS23h6LSH+PsN7Yfue+v8cxwRXV0cnFpcBAbS5FxPpdDUyWvdytzdAZi6MSaLpZ86YV9eLa0jx5suWsjq5d6v3rka4mlSNqsQX04N8g0= ;
In-reply-to: <OF8A93EC50.AABB9299-ON852570D0.0072FBD2-852570D0.00738D5E@na.pg.com>
Hello,

is there a generic function which can generate the
summary table (like the one generated by 'table'
function in splus/R) based on two factors and a column
of counts

I have a table of n x 4 out of which the 1st two are
factors and other two are counts for case and control
resp.. I need to generate either a table of 3
dimensions f1 x f2 x 2, or two tables of f1 x f2 size
with there dimnames matched for both controls and
cases.

Here is an example:
mydata = 
      f1     f2    n1          n2
1     311    112  239.87344  239.829302
2     311    114  166.50672  168.512009
3     311    142  870.56154  869.301191
4     311    312  120.39770  119.280942
5     311    342    1.00000   -1.308982
6     313    112   27.75878   27.834905
7     313    114   19.03609   19.961629
8     313    142  197.40857  198.818765
9     313    312   35.53144   34.929056
10    341    112 1346.87779 1346.927249
11    341    114  553.11880  553.609228
12    341    142  969.22327  969.618471

---------------------------------------
   f2
f1      112 114 142 312 342
   311   1   1   1   1   1
   313   1   1   1   1   0
   341   1   1   1   1   1
   343   1   1   1   1   0
   411   1   1   1   1   0
   413   0   0   1   0   0
   441   1   1   1   1   0
   443   1   0   0   0   0

but instead of '1's in three I need a N1, and N2's.


all help will be greatly appreciated,
Jag




                
__________________________________________ 
Yahoo! DSL ? Something to write home about. 
Just $16.99/mo. or less. 
dsl.yahoo.com 


<Prev in Thread] Current Thread [Next in Thread>