<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Rense Nieuwenhuis &#187; tables</title>
	<atom:link href="http://www.rensenieuwenhuis.nl/tag/tables/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rensenieuwenhuis.nl</link>
	<description>&#34;The extra-ordinary lies within the curve of normality&#34;</description>
	<lastBuildDate>Thu, 12 Mar 2026 14:58:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.2.2</generator>
	<item>
		<title>R-Sessions 11: Tables</title>
		<link>http://www.rensenieuwenhuis.nl/r-sessions-11-tables/</link>
		<comments>http://www.rensenieuwenhuis.nl/r-sessions-11-tables/#comments</comments>
		<pubDate>Fri, 15 Aug 2008 10:00:27 +0000</pubDate>
		<dc:creator><![CDATA[Rense Nieuwenhuis]]></dc:creator>
				<category><![CDATA[R-Project]]></category>
		<category><![CDATA[R-Sessions]]></category>
		<category><![CDATA[Academic Software]]></category>
		<category><![CDATA[open-source]]></category>
		<category><![CDATA[Statistics]]></category>
		<category><![CDATA[tables]]></category>

		<guid isPermaLink="false">http://www.rensenieuwenhuis.nl/?p=425</guid>
		<description><![CDATA[The one most often used function in the analysis of statistical data is the creation of tables. This edition of the R-Sessions describes the use of several functions to do some nifty cross-tabulations. And more.]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.rensenieuwenhuis.nl/archive/category/r-project/r-sessions/"><img src="http://i0.wp.com/www.rensenieuwenhuis.nl/wp-content/uploads/2008/07/r-sessions.jpg?w=470" " title="R-Sessions" data-recalc-dims="1" /></a></p>
<p><!--adsense--><br />
The one most often used function in the analysis of statistical data is the creation of tables. This edition of the R-Sessions describes the use of several functions to do some nifty cross-tabulations. And more.</p>
<h2>TAPPLY</h2>
<p>The function TAPPLY can be used to perform calculations on table-marginals. Different functions can be used, such as MEAN, SUM, VAR, SD, LENGTH (for frequency-tables). For example: <span id="more-425"></span></p>
<blockquote><p> x &lt;- c(0,1,2,3,4,5,6,7,8,9)<br />
y &lt;- c(1,1,1,1,1,1,2,2,2,2)<br />
tapply(x,y,mean)<br />
tapply(x,y,sum)<br />
tapply(x,y,var)<br />
tapply(x,y,length)</p></blockquote>
<pre>
&gt; x &lt;- c(0,1,2,3,4,5,6,7,8,9)
&gt; y &lt;- c(1,1,1,1,1,1,2,2,2,2)
&gt; tapply(x,y,mean)
  1     2
2.5   7.5
&gt; tapply(x,y,sum)
 1  2
15 30
&gt; tapply(x,y,var)
       1        2
3.500000 1.666667
&gt; tapply(x,y,length)
1 2
6 4
&gt;</pre>
<h2>FTABLE</h2>
<p>More elaborate frequency tables can be created with the FTABLE-function. For example:</p>
<blockquote><p> x &lt;- c(0,1,2,3,4,5,6,7,8,9)<br />
y &lt;- c(1,1,1,1,1,1,2,2,2,2)<br />
z &lt;- c(1,1,1,2,2,2,2,2,1,1)<br />
ftable(x,y,z)</p></blockquote>
<pre>
&gt; x &lt;- c(0,1,2,3,4,5,6,7,8,9)
&gt; y &lt;- c(1,1,1,1,1,1,2,2,2,2)
&gt; z &lt;- c(1,1,1,2,2,2,2,2,1,1)
&gt; ftable(x,y,z)
    z 1 2
x y
0 1   1 0
  2   0 0
1 1   1 0
  2   0 0
2 1   1 0
  2   0 0
3 1   0 1
  2   0 0
4 1   0 1
  2   0 0
5 1   0 1
  2   0 0
6 1   0 0
  2   0 1
7 1   0 0
  2   0 1
8 1   0 0
  2   1 0
9 1   0 0
  2   1 0</pre>
<p><i><br />
&#8211; &#8211; &#8212; &#8212; &#8212;&#8211; &#8212;&#8212;&#8211;</p>
<ul>
<li><b><a href="http://www.rensenieuwenhuis.nl/R-forum/">Discuss this article and pose additional questions in the R-Sessions Forum</a></b></li>
<li><b><a href="http://www.rensenieuwenhuis.nl/r-project/manual/basics/tables/">Find the original article embedded in the manual.</a></b></li>
</ul>
<p>&#8211; &#8211; &#8212; &#8212; &#8212;&#8211; &#8212;&#8212;&#8211;<br />
<a href="http://www.rensenieuwenhuis.nl/archive/category/r-project/r-sessions/">R-Sessions</a> is a collection of manual chapters for R-Project, which are maintained on <a href="www.rensenieuwenhuis.nl">Curving Normality</a>. All posts are linked to the chapters from the R-Project manual on this site. The manual is free to use, for it is paid by the advertisements, but please refer to it in your work inspired by it. Feedback and topic requests are highly appreciated.<br />
&#8212;&#8212;&#8211; &#8212;&#8211; &#8212; &#8212; &#8211; &#8211;<br />
</i></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rensenieuwenhuis.nl/r-sessions-11-tables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
