<html>
<head>
</head>
<body>
A simple way to achieve your goal:<br>
<br>
> x<-rpois(100,2)<br>
> y<-rpois(100,1)<br>
> z<-table(x,y)<br>
> z<br>
y<br>
x 0 1 2 3 4<br>
0 7 8 3 0 1<br>
1 10 5 3 1 0<br>
2 12 12 5 0 0<br>
3 5 6 5 0 1<br>
4 4 2 0 0 0<br>
5 4 1 2 0 1<br>
6 1 1 0 0 0<br>
> z/sum(z)<br>
y<br>
x 0
1 2
3 4<br>
0 0.07 0.08 0.03 0.00 0.01<br>
1 0.10 0.05 0.03 0.01 0.00<br>
2 0.12 0.12 0.05 0.00 0.00<br>
3 0.05 0.06 0.05 0.00 0.01<br>
4 0.04 0.02 0.00 0.00 0.00<br>
5 0.04 0.01 0.02 0.00 0.01<br>
6 0.01 0.01 0.00 0.00 0.00<br>
> round(z/apply(z,1,sum),2)<br>
y<br>
x 0
1 2
3 4<br>
0 0.37 0.42 0.16 0.00 0.05<br>
1 0.53 0.26 0.16 0.05 0.00<br>
2 0.41 0.41 0.17 0.00 0.00<br>
3 0.29 0.35 0.29 0.00 0.06<br>
4 0.67 0.33 0.00 0.00 0.00<br>
5 0.50 0.12 0.25 0.00 0.12<br>
6 0.50 0.50 0.00 0.00 0.00<br>
> round(z/apply(z,2,sum),2)<br>
y<br>
x 0
1 2
3 4<br>
0 0.16 0.44 1.00 0.00 1.00<br>
1 0.29 5.00 0.07 0.06 0.00<br>
2 0.67 4.00 0.14 0.00 0.00<br>
3 5.00 0.14 0.28 0.00 0.03<br>
4 1.33 0.06 0.00 0.00 0.00<br>
5 0.09 0.06 0.67 0.00 1.00<br>
6 0.03 1.00 0.00 0.00 0.00<br>
<br>
<br>
Best, isaia.<br>
<br>
Ko-Kang Kevin Wang wrote:<br>
<blockquote type="cite"
cite="mid:Pine.SOL.4.21.0208121627310.12879-100000@stat1.stat.auckland.ac.nz">
<pre wrap="">Hi,<br><br>Suppose I have something
like:<br></pre>
<blockquote type="cite">
<pre wrap="">table(x, y)<br></pre>
</blockquote>
<pre wrap=""><!----> y<br>x 1 2 3
4<br>1 21 55 60 50<br>2 51 121 83 90<br>3 1 1 1
0<br>4 1 1 10 11<br>5 3 5 16 5<br>6 14 18 14
1<br>7 0 2 4 2<br>8 1 5 5 1<br>9 19 35 26
17<br><br><br>Is there an easy way to display the table as
percentage, instead of the<br>actual
frequencies?<br><br>Cheers,<br><br>Kevin<br><br>------------------------------------------------------------------------------<br>Ko-Kang
Kevin Wang<br>Postgraduate PGDipSci Student<br>Department of
Statistics<br>University of Auckland<br>New
Zealand<br>Homepage: <a class="moz-txt-link-freetext"
href="http://www.stat.auckland.ac.nz/%7Ekwan022">http://www.stat.auckland.ac.nz/~kwan022</a><br><br><br>-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-<br>r-help
mailing list -- Read <a class="moz-txt-link-freetext"
href="http://www.ci.tuwien.ac.at/%7Ehornik/R/R-FAQ.html">http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html</a><br>Send
"info", "help", or "[un]su
bscr
ibe"<br>(in the "body", not the subject !) To: <a
class="moz-txt-link-abbreviated"
href="mailto:r-help-request@stat.math.ethz.ch">r-help-request@stat.math.ethz.ch</a><br>_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._<br><br></pre>
</blockquote>
<br>
<pre class="moz-signature" cols="$mailwrapcol">--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Ennio D. Isaia
~ Dep. of Statistics & Mathematics, University of Torino
~ Piazza Arbarello, 8 - 10128 Torino (Italy)
~ Phone: +39 011 670 62 51 ~~ Fax: +39 011 670 62 39
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
</pre>
<br>
<br>
</body>
</html>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To:
r-help-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._