Message-ID: <Pine.GSO.4.64.0802081140460.109@c1.hrz.uni-giessen.de>
Date: 2008-02-08T10:42:23Z
From: Gerrit Eichner
Subject: Row percentages for a table object
In-Reply-To: <47AC1809.2070500@bitwrit.com.au>
> Tom Backer Johnsen wrote:
>> I an stumbling on something that is probably very simple, but I cannot
>> see the solution. I have an object generated by the table () function
>> and want to recompute this table so each cell represents the
>> percentage of the corresponding row sum.
>>
>> Of course a dedicated function can be written (which I have done),
>> containing the necessary loops etc., but there should be a simpler
>> way. I'd prefer something simple and as transparent as possible since
>> it is for use in a text I am writing for my students. I have fiddled
>> around with the apply () function but have so far been unable to find
>> something that works.
>>
Maybe a look at
?prop.table
and/or
?addmargins
could help you.
Regards -- Gerrit
---------------------------------------------------------------------
AR Dr. Gerrit Eichner Mathematical Institute
gerrit.eichner at math.uni-giessen.de Justus-Liebig-University Giessen
Tel: +49-(0)641-99-32104 Arndtstr. 2, 35392 Giessen, Germany
Fax: +49-(0)641-99-32029 http://www.math.uni-giessen.de