<?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>R-statistics blog &#187; R</title>
	<atom:link href="http://www.r-statistics.com/tag/r/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.r-statistics.com</link>
	<description>Writing about statistics with R, and open source stuff (software, data, community)</description>
	<lastBuildDate>Mon, 30 Jan 2012 07:45:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Interactive Graphics with the iplots Package (from &#8220;R in Action&#8221;)</title>
		<link>http://www.r-statistics.com/2012/01/interactive-graphics-with-the-iplots-package-from-r-in-action/</link>
		<comments>http://www.r-statistics.com/2012/01/interactive-graphics-with-the-iplots-package-from-r-in-action/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 12:29:38 +0000</pubDate>
		<dc:creator>Tal Galili</dc:creator>
				<category><![CDATA[R]]></category>
		<category><![CDATA[visualization]]></category>
		<category><![CDATA[ihist]]></category>
		<category><![CDATA[interaction visualization]]></category>
		<category><![CDATA[iplot]]></category>
		<category><![CDATA[iplots]]></category>
		<category><![CDATA[manning]]></category>
		<category><![CDATA[R in action]]></category>

		<guid isPermaLink="false">http://www.r-statistics.com/?p=913</guid>
		<description><![CDATA[The followings introductory post is intended for new users of R.  It deals with interactive visualization using R through the iplots package. This is a guest article by Dr. Robert I. Kabacoff, the founder of (one of) the first online R tutorials websites: Quick-R. Kabacoff has recently published the book &#8221;R in Action&#8220;, providing a detailed walk-through for the [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:right;"><div class="socialize-in-button socialize-in-button-right"><iframe src="http://www.facebook.com/plugins/like.php?href=http://www.r-statistics.com/2012/01/interactive-graphics-with-the-iplots-package-from-r-in-action/&amp;layout=box_count&amp;show_faces=false&amp;width=50&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px !important; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.r-statistics.com/2012/01/interactive-graphics-with-the-iplots-package-from-r-in-action/"></g:plusone></div></div><p><strong>The followings introductory post is intended for new users of R.  It deals with interactive visualization using R through the iplots package.</strong></p>
<p>This is a guest article by Dr. <a href="http://www.statmethods.net/about/author.html">Robert I. Kabacoff</a>, the founder of (one of) the first online R tutorials websites: <a href="http://www.statmethods.net/interface/index.html">Quick-R</a>. Kabacoff has recently published the book &#8221;<strong><a href="http://affiliate.manning.com/idevaffiliate.php?id=1205&amp;url=21">R in Action</a></strong>&#8220;, providing a detailed walk-through for the R language based on various examples for illustrating R’s features (data manipulation, statistical methods, graphics, and so on&#8230;). In <a href="http://www.r-statistics.com/2011/12/data-frame-objects-in-r-via-r-in-action/">previous guest post</a>s by Kabacoff we introduced <a href="http://www.r-statistics.com/2011/12/data-frame-objects-in-r-via-r-in-action/">data.frame objects in R</a> and dealt with the <a href="http://www.r-statistics.com/2012/01/aggregation-and-restructuring-data-from-r-in-action/">Aggregation and Restructuring of data</a> (using base R functions and the reshape package).</p>
<p><a href="http://affiliate.manning.com/idevaffiliate.php?id=1205&amp;url=21"><img class="alignright" title="R in Action cover image" src="http://www.r-statistics.com/wp-content/uploads/2011/12/kabacoff_cover150.jpg" alt="" width="150" height="188" /></a>For readers of this blog, there is a<strong> 38% discount</strong> off <a href="http://affiliate.manning.com/idevaffiliate.php?id=1205&amp;url=21">the &#8220;R in Action&#8221; book</a> (as well as all other eBooks, pBooks and MEAPs at <a href="http://affiliate.manning.com/idevaffiliate.php?id=1205">Manning publishing house</a>), simply by using the code <em><strong>rblogg38 </strong></em>when reaching checkout.</p>
<p>Let us now talk about Interactive Graphics with the iplots Package:<br />
<img title="More..." src="http://www.r-statistics.com/wp-includes/js/tinymce/plugins/wordpress/img/trans.gif" alt="" /></p>
<p><span id="more-913"></span></p>
<h3><span style="text-decoration: underline;">Interactive Graphics with the iplots Package<br />
</span></h3>
<p>The base installation of R provides limited interactivity with graphs. You can modify graphs by issuing additional program statements, but there’s little that you can do to modify them or gather new information from them using the mouse. However, there are contributed packages that greatly enhance your ability to interact with the graphs you create—playwith, latticist, iplots, and rggobi. In this article, we’ll focus on functions provided by the iplots package. Be sure to install it before first use.</p>
<p>While playwith and latticist allow you to interact with a single graph, the iplots package takes interaction in a different direction. This package provides interactive mosaic plots, bar plots, box plots, parallel plots, scatter plots, and histograms that can be linked together and color brushed. This means that you can select and identify observations using the mouse, and highlighting observations in one graph will automatically highlight the same observations in all other open graphs. You can also use the mouse to obtain information about graphic objects such as points, bars, lines, and box plots.</p>
<p>The iplots package is implemented through Java and the primary functions are listed in table 1.</p>
<p><em>Table 1 <strong>iplot </strong>functions</em></p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="73">
<div>
<p>Function</p>
</div>
</td>
<td valign="top" width="186">
<div>
<p>Description</p>
</div>
</td>
</tr>
<tr>
<td valign="bottom" width="73">ibar()</td>
<td valign="bottom" width="186">Interactive bar chart</td>
</tr>
<tr>
<td valign="bottom" width="73">ibox()</td>
<td valign="bottom" width="186">Interactive box plot</td>
</tr>
<tr>
<td valign="bottom" width="73">ihist()</td>
<td valign="bottom" width="186">Interactive histogram</td>
</tr>
<tr>
<td valign="bottom" width="73">imap()</td>
<td valign="bottom" width="186">Interactive map</td>
</tr>
<tr>
<td valign="bottom" width="73">imosaic()</td>
<td valign="bottom" width="186">Interactive mosaic plot</td>
</tr>
<tr>
<td valign="bottom" width="73">ipcp()</td>
<td valign="bottom" width="186">Interactive parallel coordinates plot</td>
</tr>
<tr>
<td valign="bottom" width="73">iplot()</td>
<td valign="bottom" width="186">Interactive scatter plot</td>
</tr>
</tbody>
</table>
<p>To understand how iplots works, execute the code provided in listing 1.</p>
<p><em>Listing 1 iplots demonstration<br />
</em></p>

<div class="wp_codebox"><table><tr id="p9132"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code" id="p913code2"><pre class="rsplus" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">library</span><span style="color: #080;">&#40;</span>iplots<span style="color: #080;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">attach</span><span style="color: #080;">&#40;</span><span style="color: #CC9900; font-weight: bold;">mtcars</span><span style="color: #080;">&#41;</span>
cylinders <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">factor</span><span style="color: #080;">&#40;</span>cyl<span style="color: #080;">&#41;</span>
gears <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">factor</span><span style="color: #080;">&#40;</span>gear<span style="color: #080;">&#41;</span>
transmission <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">factor</span><span style="color: #080;">&#40;</span>am<span style="color: #080;">&#41;</span>
ihist<span style="color: #080;">&#40;</span>mpg<span style="color: #080;">&#41;</span>
ibar<span style="color: #080;">&#40;</span>gears<span style="color: #080;">&#41;</span>
iplot<span style="color: #080;">&#40;</span>mpg, wt<span style="color: #080;">&#41;</span>
ibox<span style="color: #080;">&#40;</span><span style="color: #CC9900; font-weight: bold;">mtcars</span><span style="color: #080;">&#91;</span><span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;mpg&quot;</span>, <span style="color: #ff0000;">&quot;wt&quot;</span>, <span style="color: #ff0000;">&quot;qsec&quot;</span>, <span style="color: #ff0000;">&quot;disp&quot;</span>, <span style="color: #ff0000;">&quot;hp&quot;</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#93;</span><span style="color: #080;">&#41;</span>
ipcp<span style="color: #080;">&#40;</span><span style="color: #CC9900; font-weight: bold;">mtcars</span><span style="color: #080;">&#91;</span><span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;mpg&quot;</span>, <span style="color: #ff0000;">&quot;wt&quot;</span>, <span style="color: #ff0000;">&quot;qsec&quot;</span>, <span style="color: #ff0000;">&quot;disp&quot;</span>, <span style="color: #ff0000;">&quot;hp&quot;</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#93;</span><span style="color: #080;">&#41;</span>
imosaic<span style="color: #080;">&#40;</span>transmission, cylinders<span style="color: #080;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">detach</span><span style="color: #080;">&#40;</span><span style="color: #CC9900; font-weight: bold;">mtcars</span><span style="color: #080;">&#41;</span></pre></td></tr></table></div>

<p>Six windows containing graphs will open. Rearrange them on the desktop so that each is visible (each can be resized if necessary). A portion of the display is provided in figure 1.</p>
<p><a href="http://www.r-statistics.com/wp-content/uploads/2012/01/iplots-example.png"><img src="http://www.r-statistics.com/wp-content/uploads/2012/01/iplots-example-300x289.png" alt="" title="iplots-example" width="300" height="289" class="aligncenter size-medium wp-image-914" /></a></p>
<p><em>Figure 1 An <strong>iplots </strong>demonstration created by listing 1. Only four of the six windows are displayed to save room. In these graphs, the user has clicked on the three-gear bar in the bar chart window.</em></p>
<p>Now try the following:</p>
<ul>
<li>Click on the three-gear bar in the Barchart (gears) window. The bar will turn red. In addition, all cars with three-gear engines will be highlighted in the other graph windows.</li>
<li>Mouse down and drag to select a rectangular region of points in the Scatter plot (wt vs mpg) window. These points will be highlighted and the corresponding observations in every other graph window will also turn red.</li>
<li>Hold down the Ctrl key and move the mouse pointer over a point, bar, box plot, or line in one of the graphs. Details about that object will appear in a pop-up window.</li>
<li>Right-click on any object and note the options that are offered in the context menu. For example, you can right-click on the Boxplot (mpg) window and change the graph to a parallel coordinates plot (PCP).</li>
<li>You can drag to select more than one object (point, bar, and so on) or use Shift-click to select noncontiguous objects. Try selecting both the three- and five-gear bars in the Barchart (gears) window.</li>
</ul>
<p>The functions in the iplots package allow you to explore the variable distributions and relationships among variables in subgroups of observations that you select interactively. This can provide insights that would be difficult and time-consuming to obtain in other ways. For more information on the iplots package, visit the project website at <a href="http://rosuda.org/iplots/">http://rosuda.org/iplots/</a>.</p>
<h3>Summary</h3>
<p>In this article, we explored one of the several packages for dynamically interacting with graphs, iplots. This package allows you to interact directly with data in graphs, leading to a greater intimacy with your data and expanded opportunities for developing insights.</p>
<p><span style="text-decoration: underline;"><br />
</span></p>
<p><em>This article first appeared as chapter 16.4.4 from the &#8220;<a href="http://affiliate.manning.com/idevaffiliate.php?id=1205&amp;url=21">R in action</a><strong>&#8220;</strong> book, and is published with permission from <a href="http://affiliate.manning.com/idevaffiliate.php?id=1205">Manning publishing house</a>.  Other books in this serious which you might be interested in are (see the beginning of this post for a discount code):</em></p>
<ul>
<li><a href="http://affiliate.manning.com/idevaffiliate.php?id=1205&amp;url=22">Machine Learning in Action </a>by Peter Harrington</li>
</ul>
<ul>
<li><a href="http://affiliate.manning.com/idevaffiliate.php?id=1205&amp;url=23">Gnuplot in Action</a> (Understanding Data with Graphs) by Philipp K. Janert</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.r-statistics.com/2012/01/interactive-graphics-with-the-iplots-package-from-r-in-action/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Merging two data.frame objects while preserving the rows&#8217; order</title>
		<link>http://www.r-statistics.com/2012/01/merging-two-data-frame-objects-while-preserving-the-rows-order/</link>
		<comments>http://www.r-statistics.com/2012/01/merging-two-data-frame-objects-while-preserving-the-rows-order/#comments</comments>
		<pubDate>Sun, 15 Jan 2012 11:17:01 +0000</pubDate>
		<dc:creator>Tal Galili</dc:creator>
				<category><![CDATA[R]]></category>
		<category><![CDATA[data.frame]]></category>
		<category><![CDATA[merge]]></category>
		<category><![CDATA[merging]]></category>
		<category><![CDATA[order]]></category>
		<category><![CDATA[sort]]></category>
		<category><![CDATA[sorting]]></category>

		<guid isPermaLink="false">http://www.r-statistics.com/?p=903</guid>
		<description><![CDATA[Merging two data.frame objects in R is very easily done by using the merge function. While being very powerful, the merge function does not (as of yet) offer to return a merged data.frame that preserved the original order of, one of the two merged, data.frame objects. In this post I describe this problem, and offer [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:right;"><div class="socialize-in-button socialize-in-button-right"><iframe src="http://www.facebook.com/plugins/like.php?href=http://www.r-statistics.com/2012/01/merging-two-data-frame-objects-while-preserving-the-rows-order/&amp;layout=box_count&amp;show_faces=false&amp;width=50&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px !important; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.r-statistics.com/2012/01/merging-two-data-frame-objects-while-preserving-the-rows-order/"></g:plusone></div></div><p>Merging two data.frame objects in R is very easily done by using the merge function.  While being very powerful, the merge function does not (as of yet) offer to return a merged data.frame that preserved the original order of, one of the two merged, data.frame objects.<br />
In this post I describe this problem, and offer some easy to use code to solve it.<br />
<span id="more-903"></span></p>
<p>Let us start with a simple example:</p>

<div class="wp_codebox"><table><tr id="p9036"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code" id="p903code6"><pre class="rsplus" style="font-family:monospace;">    x <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">data.<span style="">frame</span></span><span style="color: #080;">&#40;</span>
           ref <span style="color: #080;">=</span> <span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span> <span style="color: #ff0000;">'Ref1'</span>, <span style="color: #ff0000;">'Ref2'</span> <span style="color: #080;">&#41;</span>
         , label <span style="color: #080;">=</span> <span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span> <span style="color: #ff0000;">'Label01'</span>, <span style="color: #ff0000;">'Label02'</span> <span style="color: #080;">&#41;</span>
         <span style="color: #080;">&#41;</span>
    y <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">data.<span style="">frame</span></span><span style="color: #080;">&#40;</span>
          id <span style="color: #080;">=</span> <span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span> <span style="color: #ff0000;">'A1'</span>, <span style="color: #ff0000;">'C2'</span>, <span style="color: #ff0000;">'B3'</span>, <span style="color: #ff0000;">'D4'</span> <span style="color: #080;">&#41;</span>
        , ref <span style="color: #080;">=</span> <span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span> <span style="color: #ff0000;">'Ref1'</span>, <span style="color: #ff0000;">'Ref2'</span> , <span style="color: #ff0000;">'Ref3'</span>,<span style="color: #ff0000;">'Ref1'</span> <span style="color: #080;">&#41;</span>
        , val <span style="color: #080;">=</span> <span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span> <span style="color: #ff0000;">1.11</span>, <span style="color: #ff0000;">2.22</span>, <span style="color: #ff0000;">3.33</span>, <span style="color: #ff0000;">4.44</span> <span style="color: #080;">&#41;</span>
        <span style="color: #080;">&#41;</span>
&nbsp;
<span style="color: #228B22;">#######################</span>
<span style="color: #228B22;"># having a look at the two data.frame objects:</span>
<span style="color: #080;">&gt;</span> x
   ref   label
<span style="color: #ff0000;">1</span> Ref1 Label01
<span style="color: #ff0000;">2</span> Ref2 Label02
<span style="color: #080;">&gt;</span> y
  id  ref  val
<span style="color: #ff0000;">1</span> A1 Ref1 <span style="color: #ff0000;">1.11</span>
<span style="color: #ff0000;">2</span> C2 Ref2 <span style="color: #ff0000;">2.22</span>
<span style="color: #ff0000;">3</span> B3 Ref3 <span style="color: #ff0000;">3.33</span>
<span style="color: #ff0000;">4</span> D4 Ref1 <span style="color: #ff0000;">4.44</span></pre></td></tr></table></div>

<p>If we will now merge the two objects, we will find that the order of the rows is different then the original order of the &#8220;y&#8221; object.  This is true whether we use &#8220;sort =T&#8221; or &#8220;sort=F&#8221;.  You can notice that the original order was an ascending order of the &#8220;val&#8221; variable:</p>

<div class="wp_codebox"><table><tr id="p9037"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code" id="p903code7"><pre class="rsplus" style="font-family:monospace;"><span style="color: #080;">&gt;</span> <span style="color: #0000FF; font-weight: bold;">merge</span><span style="color: #080;">&#40;</span> x, y, <span style="color: #0000FF; font-weight: bold;">by</span><span style="color: #080;">=</span><span style="color: #ff0000;">'ref'</span>, all.<span style="">y</span> <span style="color: #080;">=</span> <span style="color: #0000FF; font-weight: bold;">T</span>, <span style="color: #0000FF; font-weight: bold;">sort</span><span style="color: #080;">=</span> <span style="color: #0000FF; font-weight: bold;">T</span><span style="color: #080;">&#41;</span>
   ref   label id  val
<span style="color: #ff0000;">1</span> Ref1 Label01 A1 <span style="color: #ff0000;">1.11</span>
<span style="color: #ff0000;">2</span> Ref1 Label01 D4 <span style="color: #ff0000;">4.44</span>
<span style="color: #ff0000;">3</span> Ref2 Label02 C2 <span style="color: #ff0000;">2.22</span>
<span style="color: #ff0000;">4</span> Ref3    <span style="color: #080;">&lt;</span>NA<span style="color: #080;">&gt;</span> B3 <span style="color: #ff0000;">3.33</span>
<span style="color: #080;">&gt;</span> <span style="color: #0000FF; font-weight: bold;">merge</span><span style="color: #080;">&#40;</span> x, y, <span style="color: #0000FF; font-weight: bold;">by</span><span style="color: #080;">=</span><span style="color: #ff0000;">'ref'</span>, all.<span style="">y</span> <span style="color: #080;">=</span> <span style="color: #0000FF; font-weight: bold;">T</span>, <span style="color: #0000FF; font-weight: bold;">sort</span><span style="color: #080;">=</span><span style="color: #0000FF; font-weight: bold;">F</span> <span style="color: #080;">&#41;</span>
   ref   label id  val
<span style="color: #ff0000;">1</span> Ref1 Label01 A1 <span style="color: #ff0000;">1.11</span>
<span style="color: #ff0000;">2</span> Ref1 Label01 D4 <span style="color: #ff0000;">4.44</span>
<span style="color: #ff0000;">3</span> Ref2 Label02 C2 <span style="color: #ff0000;">2.22</span>
<span style="color: #ff0000;">4</span> Ref3    <span style="color: #080;">&lt;</span>NA<span style="color: #080;">&gt;</span> B3 <span style="color: #ff0000;">3.33</span></pre></td></tr></table></div>

<p>This is explained in the help page of ?merge:</p>
<blockquote><p>The rows are by default lexicographically sorted on the common columns, but for ‘sort = FALSE’ are in an unspecified order.
</p></blockquote>
<p>Or put differently: sort=FALSE doesn&#8217;t preserve the order of any of the two entered data.frame objects (x or y); instead it gives us an<br />
unspecified (potentially random) order.</p>
<p>However, it can so happen that we want to make sure the order of the resulting merged data.frame objects ARE ordered according to the order of one of the two original objects.  In order to make sure of that, we could add an extra &#8220;id&#8221; (row index number) sequence on the dataframe we wish to sort on.  Then, we can merge the two data.frame objects, sort by the sequence, and delete the sequence. (this was previously mentioned on the R-help mailing list by <a href="http://www.mail-archive.com/r-help@r-project.org/msg83160.html">Bart Joosen</a>).</p>
<p>Following is a function that implements this logic, followed by an example for its use:</p>

<div class="wp_codebox"><table><tr id="p9038"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
</pre></td><td class="code" id="p903code8"><pre class="rsplus" style="font-family:monospace;"><span style="color: #228B22;">############## function:</span>
	merge.<span style="">with</span>.<span style="">order</span> <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">function</span><span style="color: #080;">&#40;</span>x,y, ..., <span style="color: #0000FF; font-weight: bold;">sort</span> <span style="color: #080;">=</span> <span style="color: #0000FF; font-weight: bold;">T</span>, keep_order<span style="color: #080;">&#41;</span>
	<span style="color: #080;">&#123;</span>
		<span style="color: #228B22;"># this function works just like merge, only that it adds the option to return the merged data.frame ordered by x (1) or by y (2)</span>
		add.<span style="">id</span>.<span style="">column</span>.<span style="">to</span>.<span style="">data</span> <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">function</span><span style="color: #080;">&#40;</span>DATA<span style="color: #080;">&#41;</span>
		<span style="color: #080;">&#123;</span>
			<span style="color: #0000FF; font-weight: bold;">data.<span style="">frame</span></span><span style="color: #080;">&#40;</span>DATA, id... <span style="color: #080;">=</span> <span style="color: #0000FF; font-weight: bold;">seq_len</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">nrow</span><span style="color: #080;">&#40;</span>DATA<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
		<span style="color: #080;">&#125;</span>
		<span style="color: #228B22;"># add.id.column.to.data(data.frame(x = rnorm(5), x2 = rnorm(5)))</span>
		order.<span style="">by</span>.<span style="">id</span>...<span style="">and</span>.<span style="">remove</span>.<span style="">it</span> <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">function</span><span style="color: #080;">&#40;</span>DATA<span style="color: #080;">&#41;</span>
		<span style="color: #080;">&#123;</span>
			<span style="color: #228B22;"># gets in a data.frame with the &quot;id...&quot; column.  Orders by it and returns it</span>
			<span style="color: #0000FF; font-weight: bold;">if</span><span style="color: #080;">&#40;</span><span style="color: #080;">!</span><span style="color: #0000FF; font-weight: bold;">any</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">colnames</span><span style="color: #080;">&#40;</span>DATA<span style="color: #080;">&#41;</span><span style="color: #080;">==</span><span style="color: #ff0000;">&quot;id...&quot;</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span> <span style="color: #0000FF; font-weight: bold;">stop</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;The function order.by.id...and.remove.it only works with data.frame objects which includes the 'id...' order column&quot;</span><span style="color: #080;">&#41;</span>
&nbsp;
			ss_r <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">order</span><span style="color: #080;">&#40;</span>DATA$id...<span style="color: #080;">&#41;</span>
			ss_c <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">colnames</span><span style="color: #080;">&#40;</span>DATA<span style="color: #080;">&#41;</span> <span style="color: #080;">!=</span> <span style="color: #ff0000;">&quot;id...&quot;</span>
			DATA<span style="color: #080;">&#91;</span>ss_r, ss_c<span style="color: #080;">&#93;</span>		
		<span style="color: #080;">&#125;</span>
&nbsp;
		<span style="color: #228B22;"># tmp &lt;- function(x) x==1; 1	# why we must check what to do if it is missing or not...</span>
		<span style="color: #228B22;"># tmp()</span>
&nbsp;
		<span style="color: #0000FF; font-weight: bold;">if</span><span style="color: #080;">&#40;</span><span style="color: #080;">!</span><span style="color: #0000FF; font-weight: bold;">missing</span><span style="color: #080;">&#40;</span>keep_order<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
		<span style="color: #080;">&#123;</span>
			<span style="color: #0000FF; font-weight: bold;">if</span><span style="color: #080;">&#40;</span>keep_order <span style="color: #080;">==</span> <span style="color: #ff0000;">1</span><span style="color: #080;">&#41;</span> <span style="color: #0000FF; font-weight: bold;">return</span><span style="color: #080;">&#40;</span>order.<span style="">by</span>.<span style="">id</span>...<span style="">and</span>.<span style="">remove</span>.<span style="">it</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">merge</span><span style="color: #080;">&#40;</span>x<span style="color: #080;">=</span>add.<span style="">id</span>.<span style="">column</span>.<span style="">to</span>.<span style="">data</span><span style="color: #080;">&#40;</span>x<span style="color: #080;">&#41;</span>,y<span style="color: #080;">=</span>y,..., <span style="color: #0000FF; font-weight: bold;">sort</span> <span style="color: #080;">=</span> FALSE<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
			<span style="color: #0000FF; font-weight: bold;">if</span><span style="color: #080;">&#40;</span>keep_order <span style="color: #080;">==</span> <span style="color: #ff0000;">2</span><span style="color: #080;">&#41;</span> <span style="color: #0000FF; font-weight: bold;">return</span><span style="color: #080;">&#40;</span>order.<span style="">by</span>.<span style="">id</span>...<span style="">and</span>.<span style="">remove</span>.<span style="">it</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">merge</span><span style="color: #080;">&#40;</span>x<span style="color: #080;">=</span>x,y<span style="color: #080;">=</span>add.<span style="">id</span>.<span style="">column</span>.<span style="">to</span>.<span style="">data</span><span style="color: #080;">&#40;</span>y<span style="color: #080;">&#41;</span>,..., <span style="color: #0000FF; font-weight: bold;">sort</span> <span style="color: #080;">=</span> FALSE<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
			<span style="color: #228B22;"># if you didn't get &quot;return&quot; by now - issue a warning.</span>
			<span style="color: #0000FF; font-weight: bold;">warning</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;The function merge.with.order only accepts NULL/1/2 values for the keep_order variable&quot;</span><span style="color: #080;">&#41;</span>
		<span style="color: #080;">&#125;</span> <span style="color: #0000FF; font-weight: bold;">else</span> <span style="color: #080;">&#123;</span><span style="color: #0000FF; font-weight: bold;">return</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">merge</span><span style="color: #080;">&#40;</span>x<span style="color: #080;">=</span>x,y<span style="color: #080;">=</span>y,..., <span style="color: #0000FF; font-weight: bold;">sort</span> <span style="color: #080;">=</span> <span style="color: #0000FF; font-weight: bold;">sort</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#125;</span>
	<span style="color: #080;">&#125;</span>
&nbsp;
<span style="color: #228B22;">######### example:</span>
<span style="color: #080;">&gt;</span>     <span style="color: #0000FF; font-weight: bold;">merge</span><span style="color: #080;">&#40;</span> x.<span style="">labels</span>, x.<span style="">vals</span>, <span style="color: #0000FF; font-weight: bold;">by</span><span style="color: #080;">=</span><span style="color: #ff0000;">'ref'</span>, all.<span style="">y</span> <span style="color: #080;">=</span> <span style="color: #0000FF; font-weight: bold;">T</span>, <span style="color: #0000FF; font-weight: bold;">sort</span><span style="color: #080;">=</span><span style="color: #0000FF; font-weight: bold;">F</span> <span style="color: #080;">&#41;</span>
   ref   label id  val
<span style="color: #ff0000;">1</span> Ref1 Label01 A1 <span style="color: #ff0000;">1.11</span>
<span style="color: #ff0000;">2</span> Ref1 Label01 D4 <span style="color: #ff0000;">4.44</span>
<span style="color: #ff0000;">3</span> Ref2 Label02 C2 <span style="color: #ff0000;">2.22</span>
<span style="color: #ff0000;">4</span> Ref3    <span style="color: #080;">&lt;</span>NA<span style="color: #080;">&gt;</span> B3 <span style="color: #ff0000;">3.33</span>
<span style="color: #080;">&gt;</span>     merge.<span style="">with</span>.<span style="">order</span><span style="color: #080;">&#40;</span> x.<span style="">labels</span>, x.<span style="">vals</span>, <span style="color: #0000FF; font-weight: bold;">by</span><span style="color: #080;">=</span><span style="color: #ff0000;">'ref'</span>, all.<span style="">y</span> <span style="color: #080;">=</span> <span style="color: #0000FF; font-weight: bold;">T</span>, <span style="color: #0000FF; font-weight: bold;">sort</span><span style="color: #080;">=</span><span style="color: #0000FF; font-weight: bold;">F</span> ,keep_order <span style="color: #080;">=</span> <span style="color: #ff0000;">1</span><span style="color: #080;">&#41;</span>
   ref   label id  val
<span style="color: #ff0000;">1</span> Ref1 Label01 A1 <span style="color: #ff0000;">1.11</span>
<span style="color: #ff0000;">2</span> Ref1 Label01 D4 <span style="color: #ff0000;">4.44</span>
<span style="color: #ff0000;">3</span> Ref2 Label02 C2 <span style="color: #ff0000;">2.22</span>
<span style="color: #ff0000;">4</span> Ref3    <span style="color: #080;">&lt;</span>NA<span style="color: #080;">&gt;</span> B3 <span style="color: #ff0000;">3.33</span>
<span style="color: #080;">&gt;</span>     merge.<span style="">with</span>.<span style="">order</span><span style="color: #080;">&#40;</span> x.<span style="">labels</span>, x.<span style="">vals</span>, <span style="color: #0000FF; font-weight: bold;">by</span><span style="color: #080;">=</span><span style="color: #ff0000;">'ref'</span>, all.<span style="">y</span> <span style="color: #080;">=</span> <span style="color: #0000FF; font-weight: bold;">T</span>, <span style="color: #0000FF; font-weight: bold;">sort</span><span style="color: #080;">=</span><span style="color: #0000FF; font-weight: bold;">F</span> ,keep_order <span style="color: #080;">=</span> <span style="color: #ff0000;">2</span><span style="color: #080;">&#41;</span> <span style="color: #228B22;"># yay - works as we wanted it to...</span>
   ref   label id  val
<span style="color: #ff0000;">1</span> Ref1 Label01 A1 <span style="color: #ff0000;">1.11</span>
<span style="color: #ff0000;">3</span> Ref2 Label02 C2 <span style="color: #ff0000;">2.22</span>
<span style="color: #ff0000;">4</span> Ref3    <span style="color: #080;">&lt;</span>NA<span style="color: #080;">&gt;</span> B3 <span style="color: #ff0000;">3.33</span>
<span style="color: #ff0000;">2</span> Ref1 Label01 D4 <span style="color: #ff0000;">4.44</span></pre></td></tr></table></div>

<p>Here is a description for how to use the keep_order parameter:<br />
<blockquote>keep_order can accept the numbers 1 or 2, in which case it will make sure the resulting merged data.frame will be ordered according to the original order of rows of the data.frame entered to x (if keep_order=1) or to y (if keep_order=2).  If keep_order is missing, merge will continue working as usual.  If keep_order gets some input other then 1 or 2, it will issue a warning that it doesn&#8217;t accept these values, but will continue working as merge normally would.  Notice that the parameter &#8220;sort&#8221; is practically overridden when using keep_order (with the value 1 or 2).
</p></blockquote>
<p>The same code can be used to modify the original merge.data.frame function in base R, so to allow the use of the keep_order, here is <a href="https://github.com/talgalili/R-code-snippets/blob/master/merge.data.frame.r">a link to the patched merge.data.frame function (on github).</a> If you can think of any ways to improve the function (or happen to notice a bug) please let me know either on github or in the comments.  (also saying that you found the function to be useful will be fun to know about <img src='http://www.r-statistics.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  )</p>
<p><u><strong>Update</strong></u>: Thanks to KY&#8217;s comment, I noticed the ?join function in the {plyr} library.  This function is similar to merge (with less features, yet faster), and also automatically keeps the order of the x (first) data.frame used for merging, as explained in the ?join help page:</p>
<blockquote><p>Unlike merge, (join) preserves the order of x no matter what join type is used. If needed, rows from y will be added to the bottom. Join is often faster than merge, although it is somewhat less featureful &#8211; it currently offers no way to rename output or merge on different variables in the x and y data frames.
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.r-statistics.com/2012/01/merging-two-data-frame-objects-while-preserving-the-rows-order/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Aggregation and Restructuring data (from &#8220;R in Action&#8221;)</title>
		<link>http://www.r-statistics.com/2012/01/aggregation-and-restructuring-data-from-r-in-action/</link>
		<comments>http://www.r-statistics.com/2012/01/aggregation-and-restructuring-data-from-r-in-action/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 05:29:54 +0000</pubDate>
		<dc:creator>Tal Galili</dc:creator>
				<category><![CDATA[R]]></category>
		<category><![CDATA[aggregate]]></category>
		<category><![CDATA[data.frame]]></category>
		<category><![CDATA[hadely]]></category>
		<category><![CDATA[packages]]></category>
		<category><![CDATA[reshape]]></category>
		<category><![CDATA[transpose]]></category>

		<guid isPermaLink="false">http://www.r-statistics.com/?p=891</guid>
		<description><![CDATA[The followings introductory post is intended for new users of R.  It deals with the restructuring of data: what it is and how to perform it using base R functions and the {reshape} package. This is a guest article by Dr. Robert I. Kabacoff, the founder of (one of) the first online R tutorials websites: Quick-R. Kabacoff [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:right;"><div class="socialize-in-button socialize-in-button-right"><iframe src="http://www.facebook.com/plugins/like.php?href=http://www.r-statistics.com/2012/01/aggregation-and-restructuring-data-from-r-in-action/&amp;layout=box_count&amp;show_faces=false&amp;width=50&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px !important; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.r-statistics.com/2012/01/aggregation-and-restructuring-data-from-r-in-action/"></g:plusone></div></div><p><strong>The followings introductory post is intended for new users of R.  It deals with the restructuring of data: what it is and how to perform it using base R functions and the {reshape} package.</strong></p>
<p>This is a guest article by Dr. <a href="http://www.statmethods.net/about/author.html">Robert I. Kabacoff</a>, the founder of (one of) the first online R tutorials websites: <a href="http://www.statmethods.net/interface/index.html">Quick-R</a>.   Kabacoff has recently published the book &#8221;<strong><a href="http://affiliate.manning.com/idevaffiliate.php?id=1205&amp;url=21">R in Action</a></strong>&#8220;, providing a detailed walk-through for the R language based on various examples for illustrating R’s features (data manipulation, statistical methods, graphics, and so on&#8230;).  The <a href="http://www.r-statistics.com/2011/12/data-frame-objects-in-r-via-r-in-action/">previous guest post</a> by Kabacoff introduced <a href="http://www.r-statistics.com/2011/12/data-frame-objects-in-r-via-r-in-action/">data.frame objects in R</a>.</p>
<p><a href="http://affiliate.manning.com/idevaffiliate.php?id=1205&amp;url=21"><img class="alignright" title="R in Action cover image" src="http://www.r-statistics.com/wp-content/uploads/2011/12/kabacoff_cover150.jpg" alt="" width="150" height="188" /></a>For readers of this blog, there is a<strong> 38% discount</strong> off <a href="http://affiliate.manning.com/idevaffiliate.php?id=1205&amp;url=21">the &#8220;R in Action&#8221; book</a> (as well as all other eBooks, pBooks and MEAPs at <a href="http://affiliate.manning.com/idevaffiliate.php?id=1205">Manning publishing house</a>), simply by using the code <em><strong>rblogg38 </strong></em>when reaching checkout.</p>
<p>Let us now talk about the Aggregation and Restructuring of data in R:<br />
<img title="More..." src="http://www.r-statistics.com/wp-includes/js/tinymce/plugins/wordpress/img/trans.gif" alt="" /></p>
<p><span id="more-891"></span></p>
<h3><span style="text-decoration: underline;">Aggregation and Restructuring</span></h3>
<p>R provides a number of powerful methods for aggregating and reshaping data. When you aggregate data, you replace groups of observations with summary statistics based on those observations. When you reshape data, you alter the structure (rows and columns) determining how the data is organized. This article describes a variety of methods for accomplishing these tasks.</p>
<p>We’ll use the mtcars data frame that’s included with the base installation of R. This dataset, extracted from Motor Trend magazine (1974), describes the design and performance characteristics (number of cylinders, displacement, horsepower, mpg, and so on) for 34 automobiles. To learn more about the dataset, see help(mtcars).</p>
<h3><span style="text-decoration: underline;">Transpose</span></h3>
<p>The transpose (reversing rows and columns) is perhaps the simplest method of reshaping a dataset. Use the t() function to transpose a matrix or a data frame. In the latter case, row names become variable (column) names. An example is presented in the next listing.</p>
<p><em><strong>Listing 1 Transposing a dataset</strong></em></p>

<div class="wp_codebox"><table><tr id="p89115"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code" id="p891code15"><pre class="rsplus" style="font-family:monospace;"><span style="color: #080;">&gt;</span> <span style="color: #CC9900; font-weight: bold;">cars</span> <span style="color: #080;">&lt;-</span> <span style="color: #CC9900; font-weight: bold;">mtcars</span><span style="color: #080;">&#91;</span><span style="color: #ff0000;">1</span><span style="color: #080;">:</span><span style="color: #ff0000;">5</span>,<span style="color: #ff0000;">1</span><span style="color: #080;">:</span><span style="color: #ff0000;">4</span><span style="color: #080;">&#93;</span>
<span style="color: #080;">&gt;</span> <span style="color: #CC9900; font-weight: bold;">cars</span>
                  mpg  cyl disp  hp
Mazda RX4         <span style="color: #ff0000;">21.0</span>   <span style="color: #ff0000;">6</span>  <span style="color: #ff0000;">160</span> <span style="color: #ff0000;">110</span>
Mazda RX4 Wag     <span style="color: #ff0000;">21.0</span>   <span style="color: #ff0000;">6</span>  <span style="color: #ff0000;">160</span> <span style="color: #ff0000;">110</span>
Datsun <span style="color: #ff0000;">710</span>        <span style="color: #ff0000;">22.8</span>   <span style="color: #ff0000;">4</span>  <span style="color: #ff0000;">108</span> <span style="color: #ff0000;">93</span>
Hornet <span style="color: #ff0000;">4</span> Drive    <span style="color: #ff0000;">21.4</span>   <span style="color: #ff0000;">6</span>  <span style="color: #ff0000;">258</span> <span style="color: #ff0000;">110</span>
Hornet Sportabout <span style="color: #ff0000;">18.7</span>   <span style="color: #ff0000;">8</span>  <span style="color: #ff0000;">360</span> <span style="color: #ff0000;">175</span>
<span style="color: #080;">&gt;</span> <span style="color: #0000FF; font-weight: bold;">t</span><span style="color: #080;">&#40;</span><span style="color: #CC9900; font-weight: bold;">cars</span><span style="color: #080;">&#41;</span>
     Mazda RX4 Mazda RX4 Wag Datsun <span style="color: #ff0000;">710</span> Hornet <span style="color: #ff0000;">4</span> Drive Hornet Sportabout
mpg         <span style="color: #ff0000;">21</span>        <span style="color: #ff0000;">21</span>           <span style="color: #ff0000;">22.8</span>           <span style="color: #ff0000;">21.4</span>              <span style="color: #ff0000;">18.7</span>
cyl          <span style="color: #ff0000;">6</span>         <span style="color: #ff0000;">6</span>            <span style="color: #ff0000;">4.0</span>            <span style="color: #ff0000;">6.0</span>               <span style="color: #ff0000;">8.0</span>
disp       <span style="color: #ff0000;">160</span>       <span style="color: #ff0000;">160</span>          <span style="color: #ff0000;">108.0</span>          <span style="color: #ff0000;">258.0</span>             <span style="color: #ff0000;">360.0</span>
hp         <span style="color: #ff0000;">110</span>       <span style="color: #ff0000;">110</span>           <span style="color: #ff0000;">93.0</span>           <span style="color: #ff0000;">110.0</span>            <span style="color: #ff0000;">175.0</span></pre></td></tr></table></div>

<p>Listing 1 uses a subset of the mtcars dataset in order to conserve space on the page. You’ll see a more flexible way of transposing data when we look at the reshape package later in this article.</p>
<h3><span style="text-decoration: underline;">Aggregating data</span></h3>
<p>It’s relatively easy to collapse data in R using one or more by variables and a defined function. The format is</p>

<div class="wp_codebox"><table><tr id="p89116"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p891code16"><pre class="rsplus" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">aggregate</span><span style="color: #080;">&#40;</span>x, <span style="color: #0000FF; font-weight: bold;">by</span>, FUN<span style="color: #080;">&#41;</span></pre></td></tr></table></div>

<p>where <em>x </em>is the data object to be collapsed, <em>by </em>is a list of variables that will be crossed to form the new observations, and <em>FUN </em>is the scalar function used to calculate summary statistics that will make up the new observation values.</p>
<p>As an example, we’ll aggregate the mtcars data by number of cylinders and gears, returning means on each of the numeric variables (see the next listing).</p>
<p><em><strong>Listing 2 Aggregating data</strong></em></p>

<div class="wp_codebox"><table><tr id="p89117"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code" id="p891code17"><pre class="rsplus" style="font-family:monospace;"><span style="color: #080;">&gt;</span> <span style="color: #0000FF; font-weight: bold;">options</span><span style="color: #080;">&#40;</span>digits<span style="color: #080;">=</span><span style="color: #ff0000;">3</span><span style="color: #080;">&#41;</span>
<span style="color: #080;">&gt;</span> <span style="color: #0000FF; font-weight: bold;">attach</span><span style="color: #080;">&#40;</span><span style="color: #CC9900; font-weight: bold;">mtcars</span><span style="color: #080;">&#41;</span>
<span style="color: #080;">&gt;</span> aggdata <span style="color: #080;">&lt;-</span><span style="color: #0000FF; font-weight: bold;">aggregate</span><span style="color: #080;">&#40;</span><span style="color: #CC9900; font-weight: bold;">mtcars</span>, <span style="color: #0000FF; font-weight: bold;">by</span><span style="color: #080;">=</span><span style="color: #0000FF; font-weight: bold;">list</span><span style="color: #080;">&#40;</span>cyl,gear<span style="color: #080;">&#41;</span>, FUN<span style="color: #080;">=</span><span style="color: #0000FF; font-weight: bold;">mean</span>, na.<span style="">rm</span><span style="color: #080;">=</span>TRUE<span style="color: #080;">&#41;</span>
<span style="color: #080;">&gt;</span> aggdata
  Group.1 Group.2  mpg cyl disp  hp drat   wt qsec  vs   am gear carb
<span style="color: #ff0000;">1</span>       <span style="color: #ff0000;">4</span>       <span style="color: #ff0000;">3</span> <span style="color: #ff0000;">21.5</span>   <span style="color: #ff0000;">4</span>  <span style="color: #ff0000;">120</span>  <span style="color: #ff0000;">97</span> <span style="color: #ff0000;">3.70</span> <span style="color: #ff0000;">2.46</span> <span style="color: #ff0000;">20.0</span> <span style="color: #ff0000;">1.0</span> <span style="color: #ff0000;">0.00</span>    <span style="color: #ff0000;">3</span> <span style="color: #ff0000;">1.00</span>
<span style="color: #ff0000;">2</span>       <span style="color: #ff0000;">6</span>       <span style="color: #ff0000;">3</span> <span style="color: #ff0000;">19.8</span>   <span style="color: #ff0000;">6</span>  <span style="color: #ff0000;">242</span> <span style="color: #ff0000;">108</span> <span style="color: #ff0000;">2.92</span> <span style="color: #ff0000;">3.34</span> <span style="color: #ff0000;">19.8</span> <span style="color: #ff0000;">1.0</span> <span style="color: #ff0000;">0.00</span>    <span style="color: #ff0000;">3</span> <span style="color: #ff0000;">1.00</span>
<span style="color: #ff0000;">3</span>       <span style="color: #ff0000;">8</span>       <span style="color: #ff0000;">3</span> <span style="color: #ff0000;">15.1</span>   <span style="color: #ff0000;">8</span>  <span style="color: #ff0000;">358</span> <span style="color: #ff0000;">194</span> <span style="color: #ff0000;">3.12</span> <span style="color: #ff0000;">4.10</span> <span style="color: #ff0000;">17.1</span> <span style="color: #ff0000;">0.0</span> <span style="color: #ff0000;">0.00</span>    <span style="color: #ff0000;">3</span> <span style="color: #ff0000;">3.08</span>
<span style="color: #ff0000;">4</span>       <span style="color: #ff0000;">4</span>       <span style="color: #ff0000;">4</span> <span style="color: #ff0000;">26.9</span>   <span style="color: #ff0000;">4</span>  <span style="color: #ff0000;">103</span>  <span style="color: #ff0000;">76</span> <span style="color: #ff0000;">4.11</span> <span style="color: #ff0000;">2.38</span> <span style="color: #ff0000;">19.6</span> <span style="color: #ff0000;">1.0</span> <span style="color: #ff0000;">0.75</span>    <span style="color: #ff0000;">4</span> <span style="color: #ff0000;">1.50</span>
<span style="color: #ff0000;">5</span>       <span style="color: #ff0000;">6</span>       <span style="color: #ff0000;">4</span> <span style="color: #ff0000;">19.8</span>   <span style="color: #ff0000;">6</span>  <span style="color: #ff0000;">164</span> <span style="color: #ff0000;">116</span> <span style="color: #ff0000;">3.91</span> <span style="color: #ff0000;">3.09</span> <span style="color: #ff0000;">17.7</span> <span style="color: #ff0000;">0.5</span> <span style="color: #ff0000;">0.50</span>    <span style="color: #ff0000;">4</span> <span style="color: #ff0000;">4.00</span>
<span style="color: #ff0000;">6</span>       <span style="color: #ff0000;">4</span>       <span style="color: #ff0000;">5</span> <span style="color: #ff0000;">28.2</span>   <span style="color: #ff0000;">4</span>  <span style="color: #ff0000;">108</span> <span style="color: #ff0000;">102</span> <span style="color: #ff0000;">4.10</span> <span style="color: #ff0000;">1.83</span> <span style="color: #ff0000;">16.8</span> <span style="color: #ff0000;">0.5</span> <span style="color: #ff0000;">1.00</span>    <span style="color: #ff0000;">5</span> <span style="color: #ff0000;">2.00</span>
<span style="color: #ff0000;">7</span>       <span style="color: #ff0000;">6</span>       <span style="color: #ff0000;">5</span> <span style="color: #ff0000;">19.7</span>   <span style="color: #ff0000;">6</span>  <span style="color: #ff0000;">145</span> <span style="color: #ff0000;">175</span> <span style="color: #ff0000;">3.62</span> <span style="color: #ff0000;">2.77</span> <span style="color: #ff0000;">15.5</span> <span style="color: #ff0000;">0.0</span> <span style="color: #ff0000;">1.00</span>    <span style="color: #ff0000;">5</span> <span style="color: #ff0000;">6.00</span>
<span style="color: #ff0000;">8</span>       <span style="color: #ff0000;">8</span>       <span style="color: #ff0000;">5</span> <span style="color: #ff0000;">15.4</span>   <span style="color: #ff0000;">8</span>  <span style="color: #ff0000;">326</span> <span style="color: #ff0000;">300</span> <span style="color: #ff0000;">3.88</span> <span style="color: #ff0000;">3.37</span> <span style="color: #ff0000;">14.6</span> <span style="color: #ff0000;">0.0</span> <span style="color: #ff0000;">1.00</span>    <span style="color: #ff0000;">5</span> <span style="color: #ff0000;">6.00</span></pre></td></tr></table></div>

<p>In these results, Group.1 represents the number of cylinders (4, 6, or <img src='http://www.r-statistics.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> and Group.2 represents the number of gears (3, 4, or 5). For example, cars with 4 cylinders and 3 gears have a mean of 21.5 miles per gallon (mpg).</p>
<p>When you’re using the aggregate() function , the by variables must be in a list (even if there’s only one). You can declare a custom name for the groups from within the list, for instance, using by=list(Group.cyl=cyl, Group.gears=gear).</p>
<p>The function specified can be any built-in or user-provided function. This gives the aggregate command a great deal of power. But when it comes to power, nothing beats the reshape package.</p>
<h3><span style="text-decoration: underline;">The reshape package</span></h3>
<p>The reshape package is a tremendously versatile approach to both restructuring and aggregating datasets. Because of this versatility, it can be a bit challenging to learn.</p>
<p>We’ll go through the process slowly and use a small dataset so that it’s clear what’s happening. Because reshape isn’t included in the standard installation of R, you’ll need to install it one time, using install.packages(&#8220;reshape&#8221;).</p>
<p>Basically, you’ll “melt” data so that each row is a unique ID-variable combination. Then you’ll “cast” the melted data into any shape you desire. During the cast, you can aggregate the data with any function you wish. The dataset you’ll be working with is shown in table 1.</p>
<p><em><strong>Table 1 The original dataset (mydata)</strong></em></p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="37">
<div>
<p>ID</p>
</div>
</td>
<td valign="top" width="48">
<div>
<p>Time</p>
</div>
</td>
<td valign="top" width="42">
<div>
<p>X1</p>
</div>
</td>
<td valign="top" width="36">
<div>
<p>X2</p>
</div>
</td>
</tr>
<tr>
<td valign="top" width="37">1</td>
<td valign="top" width="48">1</td>
<td valign="top" width="42">5</td>
<td valign="top" width="36">6</td>
</tr>
<tr>
<td valign="top" width="37">1</td>
<td valign="top" width="48">2</td>
<td valign="top" width="42">3</td>
<td valign="top" width="36">5</td>
</tr>
<tr>
<td valign="top" width="37">2</td>
<td valign="top" width="48">1</td>
<td valign="top" width="42">6</td>
<td valign="top" width="36">1</td>
</tr>
<tr>
<td valign="top" width="37">2</td>
<td valign="top" width="48">2</td>
<td valign="top" width="42">2</td>
<td valign="top" width="36">4</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>In this dataset, the measurements are the values in the last two columns (5, 6, 3, 5, 6, 1, 2, and 4). Each measurement is uniquely identified by a combination of ID variables (in this case ID, Time, and whether the measurement is on X1 or X2). For example, the measured value 5 in the first row is uniquely identified by knowing that it’s from observation (ID) 1, at Time 1, and on variable X1.</p>
<h3>Melting</h3>
<p>When you melt a dataset, you restructure it into a format where each measured variable is in its own row, along with the ID variables needed to uniquely identify it. If you melt the data from table 1, using the following code</p>

<div class="wp_codebox"><table><tr id="p89118"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p891code18"><pre class="rsplus" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">library</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">reshape</span><span style="color: #080;">&#41;</span>
md <span style="color: #080;">&lt;-</span> melt<span style="color: #080;">&#40;</span>mydata, id<span style="color: #080;">=</span><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;id&quot;</span>, <span style="color: #ff0000;">&quot;time&quot;</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span></pre></td></tr></table></div>

<p>You end up with the structure shown in table 2.</p>
<p><em><strong>Table 2 The melted dataset</strong></em></p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="37">
<div>
<p>ID</p>
</div>
</td>
<td valign="top" width="48">
<div>
<p>Time</p>
</div>
</td>
<td valign="top" width="78">
<div>
<p>Variable</p>
</div>
</td>
<td valign="top" width="60">
<div>
<p>Value</p>
</div>
</td>
</tr>
<tr>
<td valign="top" width="37">1</td>
<td valign="top" width="48">1</td>
<td valign="top" width="78">X1</td>
<td valign="top" width="60">5</td>
</tr>
<tr>
<td valign="top" width="37">1</td>
<td valign="top" width="48">2</td>
<td valign="top" width="78">X1</td>
<td valign="top" width="60">3</td>
</tr>
<tr>
<td valign="top" width="37">2</td>
<td valign="top" width="48">1</td>
<td valign="top" width="78">X1</td>
<td valign="top" width="60">6</td>
</tr>
<tr>
<td valign="top" width="37">2</td>
<td valign="top" width="48">2</td>
<td valign="top" width="78">X1</td>
<td valign="top" width="60">2</td>
</tr>
<tr>
<td valign="top" width="37">1</td>
<td valign="top" width="48">1</td>
<td valign="top" width="78">X2</td>
<td valign="top" width="60">6</td>
</tr>
<tr>
<td valign="top" width="37">1</td>
<td valign="top" width="48">2</td>
<td valign="top" width="78">X2</td>
<td valign="top" width="60">5</td>
</tr>
<tr>
<td valign="top" width="37">2</td>
<td valign="top" width="48">1</td>
<td valign="top" width="78">X2</td>
<td valign="top" width="60">1</td>
</tr>
<tr>
<td valign="top" width="37">2</td>
<td valign="top" width="48">2</td>
<td valign="top" width="78">X2</td>
<td valign="top" width="60">4</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>Note that you must specify the variables needed to uniquely identify each measurement (ID and Time) and that the variable indicating the measurement variable names (X1 or X2) is created for you automatically.</p>
<p>Now that you have your data in a melted form, you can recast it into any shape, using the cast() function.</p>
<p>Casting</p>
<p>The cast() function starts with melted data and reshapes it using a formula that you provide and an (optional) function used to aggregate the data. The format is</p>

<div class="wp_codebox"><table><tr id="p89119"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p891code19"><pre class="rsplus" style="font-family:monospace;">newdata <span style="color: #080;">&lt;-</span> cast<span style="color: #080;">&#40;</span>md, <span style="color: #0000FF; font-weight: bold;">formula</span>, FUN<span style="color: #080;">&#41;</span></pre></td></tr></table></div>

<p>Where <em>md </em>is the melted data, <em>formula </em>describes the desired end result, and <em>FUN </em>is the (optional) aggregating function. The formula takes the form</p>

<div class="wp_codebox"><table><tr id="p89120"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p891code20"><pre class="rsplus" style="font-family:monospace;">rowvar1 <span style="color: #080;">+</span> rowvar2 <span style="color: #080;">+</span> …  ~  colvar1 <span style="color: #080;">+</span> colvar2 <span style="color: #080;">+</span> …</pre></td></tr></table></div>

<p>In this formula, <em>rowvar1 + rowvar2 + </em>… define the set of crossed variables that define the rows, and <em>colvar1 + colvar2 + </em>… define the set of crossed variables that define the columns. See the examples in figure 1.</p>
<p><strong><a href="http://www.r-statistics.com/wp-content/uploads/2012/01/image006.gif"><img title="The reshape package scheme" src="http://www.r-statistics.com/wp-content/uploads/2012/01/image006-300x210.gif" alt="Reshaping data with the melt() and cast() functions" width="300" height="210" /></a></strong></p>
<p><strong><em>Figure 1 Reshaping data with the melt() and cast() functions</em></strong></p>
<p>Because the formulas on the right side (d, e, and f) don’t include a function, the data is reshaped. In contrast, the examples on the left side (a, b, and c) specify the mean as an aggregating function. Thus the data are not only reshaped but aggregated as well. For example, (a) gives the means on X1 and X2 averaged over time for each observation. Example (b) gives the mean scores of X1 and X2 at Time 1 and Time 2, averaged over observations. In (c) you have the mean score for each observation at Time 1 and Time 2, averaged over X1 and X2.</p>
<p>As you can see, the flexibility provided by the melt() and cast() functions is amazing. There are many times when you’ll have to reshape or aggregate your data prior to analysis. For example, you’ll typically need to place your data in what’s called long format resembling table 2 when analyzing repeated measures data (data where multiple measures are recorded for each observation).</p>
<h3>Summary</h3>
<p>Chapter 5 of<strong> </strong><a href="http://www.manning.com/kabacoff/">R in Action</a> reviews many of the dozens of mathematical, statistical, and probability functions that are useful for manipulating data. In this article, we have briefly explored several ways of aggregating and restructuring data.</p>
<p>&nbsp;</p>
<p><em>This article first appeared as chapter 5.6 from the &#8220;<a href="http://affiliate.manning.com/idevaffiliate.php?id=1205&amp;url=21">R in action</a><strong>&#8220;</strong> book, and is published with permission from <a href="http://affiliate.manning.com/idevaffiliate.php?id=1205">Manning publishing house</a>.  Other books in this serious which you might be interested in are (see the beginning of this post for a discount code):</em></p>
<ul>
<li><a href="http://affiliate.manning.com/idevaffiliate.php?id=1205&amp;url=22">Machine Learning in Action </a>by Peter Harrington</li>
</ul>
<ul>
<li><a href="http://affiliate.manning.com/idevaffiliate.php?id=1205&amp;url=23">Gnuplot in Action</a> (Understanding Data with Graphs) by Philipp K. Janert</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.r-statistics.com/2012/01/aggregation-and-restructuring-data-from-r-in-action/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>data.frame objects in R (via &#8220;R in Action&#8221;)</title>
		<link>http://www.r-statistics.com/2011/12/data-frame-objects-in-r-via-r-in-action/</link>
		<comments>http://www.r-statistics.com/2011/12/data-frame-objects-in-r-via-r-in-action/#comments</comments>
		<pubDate>Sun, 18 Dec 2011 22:02:04 +0000</pubDate>
		<dc:creator>Tal Galili</dc:creator>
				<category><![CDATA[R]]></category>
		<category><![CDATA[data frames]]></category>
		<category><![CDATA[data.frame]]></category>
		<category><![CDATA[R book]]></category>
		<category><![CDATA[R classes]]></category>
		<category><![CDATA[R in action]]></category>
		<category><![CDATA[R objects]]></category>
		<category><![CDATA[R tutorial]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.r-statistics.com/?p=865</guid>
		<description><![CDATA[The followings introductory post is intended for new users of R.  It deals with R data frames: what they are, and how to create, view, and update them. This is a guest article by Dr. Robert I. Kabacoff, the founder of (one of) the first online R tutorials websites: Quick-R.  Kabacoff has recently published the book &#8221;R [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:right;"><div class="socialize-in-button socialize-in-button-right"><iframe src="http://www.facebook.com/plugins/like.php?href=http://www.r-statistics.com/2011/12/data-frame-objects-in-r-via-r-in-action/&amp;layout=box_count&amp;show_faces=false&amp;width=50&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px !important; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.r-statistics.com/2011/12/data-frame-objects-in-r-via-r-in-action/"></g:plusone></div></div><p><strong>The followings introductory post is intended for new users of R.  It deals with R data frames: what they are, and how to create, view, and update them.</strong></p>
<p>This is a guest article by Dr. <a href="http://www.statmethods.net/about/author.html">Robert I. Kabacoff</a>, the founder of (one of) the first online R tutorials websites: <a href="http://www.statmethods.net/interface/index.html">Quick-R</a>.  Kabacoff has recently published the book &#8221;<strong><a href="http://affiliate.manning.com/idevaffiliate.php?id=1205&#038;url=21">R in Action</a></strong>&#8220;, providing a detailed walk-through for the R language based on various examples for illustrating R’s features (data manipulation, statistical methods, graphics, and so on&#8230;)</p>
<p><a href="http://affiliate.manning.com/idevaffiliate.php?id=1205&#038;url=21"><img src="http://www.r-statistics.com/wp-content/uploads/2011/12/kabacoff_cover150.jpg" alt="" title="R in Action cover image" width="150" height="188" class="alignleft size-full wp-image-874" /></a></p>
<p>For readers of this blog, there is a<strong> 38% discount</strong> off <a href="http://affiliate.manning.com/idevaffiliate.php?id=1205&#038;url=21">the &#8220;R in Action&#8221; book</a> (as well as all other eBooks, pBooks and MEAPs at <a href="http://affiliate.manning.com/idevaffiliate.php?id=1205">Manning publishing house</a>), simply by using the code <em><strong>rblogg38 </strong></em>when reaching checkout.</p>
<p>Let us now talk about data frames:<br />
<span id="more-865"></span><br />
<u><br />
<h3>Data Frames</h3>
<p></u><br />
A data frame is more general than a matrix in that different columns can contain different modes of data (numeric, character, and so on). It’s similar to the datasets you’d typically see in SAS, SPSS, and Stata. Data frames are the most common data structure you’ll deal with in R.</p>
<p>The patient dataset in table 1 consists of numeric and character data.</p>
<p><em>Table 1: A patient dataset</em></p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="67">
<div>
<p>PatientID</p>
</div>
</td>
<td valign="top" width="78">
<div>
<p>AdmDate</p>
</div>
</td>
<td valign="top" width="42">
<div>
<p>Age</p>
</div>
</td>
<td valign="top" width="60">
<div>
<p>Diabetes</p>
</div>
</td>
<td valign="top" width="66">
<div>
<p>Status</p>
</div>
</td>
</tr>
<tr>
<td valign="top" width="67">1</td>
<td valign="top" width="78">10/15/2009</td>
<td valign="top" width="42">25</td>
<td valign="top" width="60">Type1</td>
<td valign="top" width="66">Poor</td>
</tr>
<tr>
<td valign="top" width="67">2</td>
<td valign="top" width="78">11/01/2009</td>
<td valign="top" width="42">34</td>
<td valign="top" width="60">Type2</td>
<td valign="top" width="66">Improved</td>
</tr>
<tr>
<td valign="top" width="67">3</td>
<td valign="top" width="78">10/21/2009</td>
<td valign="top" width="42">28</td>
<td valign="top" width="60">Type1</td>
<td valign="top" width="66">Excellent</td>
</tr>
<tr>
<td valign="top" width="67">4</td>
<td valign="top" width="78">10/28/2009</td>
<td valign="top" width="42">52</td>
<td valign="top" width="60">Type1</td>
<td valign="top" width="66">Poor</td>
</tr>
</tbody>
</table>
<p>Because there are multiple modes of data, you can’t contain this data in a matrix. In this case, a data frame would be the structure of choice.</p>
<p>A data frame is created with the data.frame() function:</p>

<div class="wp_codebox"><table><tr id="p86532"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p865code32"><pre class="rsplus" style="font-family:monospace;">mydata <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">data.<span style="">frame</span></span><span style="color: #080;">&#40;</span>col1, col2, col3,…<span style="color: #080;">&#41;</span></pre></td></tr></table></div>

<p>where <em>col1, col2, col3, </em>… are column vectors of any type (such as character, numeric, or logical). Names for each column can be provided with the names function.</p>
<p>The following listing makes this clear.</p>
<p><strong>Listing 1 Creating a data frame</strong></p>

<div class="wp_codebox"><table><tr id="p86533"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code" id="p865code33"><pre class="rsplus" style="font-family:monospace;"><span style="color: #080;">&gt;</span> patientID <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">1</span>, <span style="color: #ff0000;">2</span>, <span style="color: #ff0000;">3</span>, <span style="color: #ff0000;">4</span><span style="color: #080;">&#41;</span>
<span style="color: #080;">&gt;</span> age <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">25</span>, <span style="color: #ff0000;">34</span>, <span style="color: #ff0000;">28</span>, <span style="color: #ff0000;">52</span><span style="color: #080;">&#41;</span>
<span style="color: #080;">&gt;</span> diabetes <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;Type1&quot;</span>, <span style="color: #ff0000;">&quot;Type2&quot;</span>, <span style="color: #ff0000;">&quot;Type1&quot;</span>, <span style="color: #ff0000;">&quot;Type1&quot;</span><span style="color: #080;">&#41;</span>
<span style="color: #080;">&gt;</span> status <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;Poor&quot;</span>, <span style="color: #ff0000;">&quot;Improved&quot;</span>, <span style="color: #ff0000;">&quot;Excellent&quot;</span>, <span style="color: #ff0000;">&quot;Poor&quot;</span><span style="color: #080;">&#41;</span>
<span style="color: #080;">&gt;</span> patientdata <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">data.<span style="">frame</span></span><span style="color: #080;">&#40;</span>patientID, age, diabetes, status<span style="color: #080;">&#41;</span>
<span style="color: #080;">&gt;</span> patientdata
  patientID age diabetes status
<span style="color: #ff0000;">1</span>         <span style="color: #ff0000;">1</span>  <span style="color: #ff0000;">25</span>    Type1 Poor
<span style="color: #ff0000;">2</span>         <span style="color: #ff0000;">2</span>  <span style="color: #ff0000;">34</span>    Type2 Improved
<span style="color: #ff0000;">3</span>         <span style="color: #ff0000;">3</span>  <span style="color: #ff0000;">28</span>    Type1 Excellent
<span style="color: #ff0000;">4</span>         <span style="color: #ff0000;">4</span>  <span style="color: #ff0000;">52</span>    Type1 Poor</pre></td></tr></table></div>

<p>Each column must have only one mode, but you can put columns of different modes together to form the data frame. Because data frames are close to what analysts typically think of as datasets, we’ll use the terms columns and variables interchangeably when discussing data frames.</p>
<p>There are several ways to identify the elements of a data frame. You can use the subscript notation or you can specify column names. Using the patientdata data frame created earlier, the following listing demonstrates these approaches.</p>
<p><strong>Listing 2 Specifying elements of a data frame</strong></p>

<div class="wp_codebox"><table><tr id="p86534"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code" id="p865code34"><pre class="rsplus" style="font-family:monospace;"><span style="color: #080;">&gt;</span> patientdata<span style="color: #080;">&#91;</span><span style="color: #ff0000;">1</span><span style="color: #080;">:</span><span style="color: #ff0000;">2</span><span style="color: #080;">&#93;</span>
  patientID age
<span style="color: #ff0000;">1</span>         <span style="color: #ff0000;">1</span>  <span style="color: #ff0000;">25</span>
<span style="color: #ff0000;">2</span>         <span style="color: #ff0000;">2</span>  <span style="color: #ff0000;">34</span>
<span style="color: #ff0000;">3</span>         <span style="color: #ff0000;">3</span>  <span style="color: #ff0000;">28</span>
<span style="color: #ff0000;">4</span>         <span style="color: #ff0000;">4</span>  <span style="color: #ff0000;">52</span>
<span style="color: #080;">&gt;</span> patientdata<span style="color: #080;">&#91;</span><span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;diabetes&quot;</span>, <span style="color: #ff0000;">&quot;status&quot;</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#93;</span>
  diabetes status
<span style="color: #ff0000;">1</span>    Type1 Poor
<span style="color: #ff0000;">2</span>    Type2 Improved
<span style="color: #ff0000;">3</span>    Type1 Excellent 
<span style="color: #ff0000;">4</span>    Type1 Poor
<span style="color: #080;">&gt;</span> patientdata$age    <span style="color: #228B22;">#age variable in the patient data frame</span>
<span style="color: #080;">&#91;</span><span style="color: #ff0000;">1</span><span style="color: #080;">&#93;</span> <span style="color: #ff0000;">25</span> <span style="color: #ff0000;">34</span> <span style="color: #ff0000;">28</span> <span style="color: #ff0000;">52</span></pre></td></tr></table></div>

<p>The $ notation in the third example is used to indicate a particular variable from a given data frame. For example, if you want to cross-tabulate diabetes type by status, you could use the following code:</p>

<div class="wp_codebox"><table><tr id="p86535"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p865code35"><pre class="rsplus" style="font-family:monospace;"><span style="color: #080;">&gt;</span> <span style="color: #0000FF; font-weight: bold;">table</span><span style="color: #080;">&#40;</span>patientdata$diabetes, patientdata$status<span style="color: #080;">&#41;</span>
&nbsp;
        Excellent Improved Poor
  Type1         <span style="color: #ff0000;">1</span>        <span style="color: #ff0000;">0</span>    <span style="color: #ff0000;">2</span>
  Type2         <span style="color: #ff0000;">0</span>        <span style="color: #ff0000;">1</span>    <span style="color: #ff0000;">0</span></pre></td></tr></table></div>

<p>It can get tiresome typing patientdata$ at the beginning of every variable name, so shortcuts are available. You can use either the attach() and detach() or with() functions to simplify your code.</p>
<h3>attach, detach, and with</h3>
<p>The attach() function adds the data frame to the R search path. When a variable name is encountered, data frames in the search path are checked in order to locate the variable. Using a sample (mtcars) data frame, you could use the following code to obtain summary statistics for automobile mileage (mpg), and plot this variable against engine displacement (disp), and weight (wt):</p>

<div class="wp_codebox"><table><tr id="p86536"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p865code36"><pre class="rsplus" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">summary</span><span style="color: #080;">&#40;</span><span style="color: #CC9900; font-weight: bold;">mtcars</span>$mpg<span style="color: #080;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">plot</span><span style="color: #080;">&#40;</span><span style="color: #CC9900; font-weight: bold;">mtcars</span>$mpg, <span style="color: #CC9900; font-weight: bold;">mtcars</span>$disp<span style="color: #080;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">plot</span><span style="color: #080;">&#40;</span><span style="color: #CC9900; font-weight: bold;">mtcars</span>$mpg, <span style="color: #CC9900; font-weight: bold;">mtcars</span>$wt<span style="color: #080;">&#41;</span></pre></td></tr></table></div>

<p>This could also be written as</p>

<div class="wp_codebox"><table><tr id="p86537"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p865code37"><pre class="rsplus" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">attach</span><span style="color: #080;">&#40;</span><span style="color: #CC9900; font-weight: bold;">mtcars</span><span style="color: #080;">&#41;</span>
  <span style="color: #0000FF; font-weight: bold;">summary</span><span style="color: #080;">&#40;</span>mpg<span style="color: #080;">&#41;</span>
  <span style="color: #0000FF; font-weight: bold;">plot</span><span style="color: #080;">&#40;</span>mpg, disp<span style="color: #080;">&#41;</span>
  <span style="color: #0000FF; font-weight: bold;">plot</span><span style="color: #080;">&#40;</span>mpg, wt<span style="color: #080;">&#41;</span>
<span style="color: #0000FF; font-weight: bold;">detach</span><span style="color: #080;">&#40;</span><span style="color: #CC9900; font-weight: bold;">mtcars</span><span style="color: #080;">&#41;</span></pre></td></tr></table></div>

<p>The detach() function removes the data frame from the search path. Note that detach() does nothing to the data frame itself. The statement is optional but is good programming practice and should be included routinely.</p>
<p>The limitations with this approach are evident when more than one object can have the same name. Consider the following code:</p>

<div class="wp_codebox"><table><tr id="p86538"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code" id="p865code38"><pre class="rsplus" style="font-family:monospace;"><span style="color: #080;">&gt;</span> mpg <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">25</span>, <span style="color: #ff0000;">36</span>, <span style="color: #ff0000;">47</span><span style="color: #080;">&#41;</span>
<span style="color: #080;">&gt;</span> <span style="color: #0000FF; font-weight: bold;">attach</span><span style="color: #080;">&#40;</span><span style="color: #CC9900; font-weight: bold;">mtcars</span><span style="color: #080;">&#41;</span>
&nbsp;
The following object<span style="color: #080;">&#40;</span>s<span style="color: #080;">&#41;</span> are masked _by_ ‘.<span style="">GlobalEnv</span>’<span style="color: #080;">:</span> mpg
<span style="color: #080;">&gt;</span> <span style="color: #0000FF; font-weight: bold;">plot</span><span style="color: #080;">&#40;</span>mpg, wt<span style="color: #080;">&#41;</span>
Error <span style="color: #0000FF; font-weight: bold;">in</span> <span style="color: #0000FF; font-weight: bold;">xy.<span style="">coords</span></span><span style="color: #080;">&#40;</span>x, y, xlabel, ylabel, <span style="color: #0000FF; font-weight: bold;">log</span><span style="color: #080;">&#41;</span> <span style="color: #080;">:</span>
  ‘x’ and ‘y’ lengths differ
<span style="color: #080;">&gt;</span> mpg
<span style="color: #080;">&#91;</span><span style="color: #ff0000;">1</span><span style="color: #080;">&#93;</span> <span style="color: #ff0000;">25</span> <span style="color: #ff0000;">36</span> <span style="color: #ff0000;">47</span></pre></td></tr></table></div>

<p>Here we already have an object named mpg in our environment when the mtcars data frame is attached. In such cases, the original object takes precedence, which isn’t what you want. The plot statement fails because mpg has 3 elements and disp has 32 elements. The attach() and detach() functions are best used when you’re analyzing a single data frame and you’re unlikely to have multiple objects with the same name. In any case, be vigilant for warnings that say that objects are being masked.</p>
<p>An alternative approach is to use the with() function. You could write the previous example as</p>

<div class="wp_codebox"><table><tr id="p86539"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p865code39"><pre class="rsplus" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">with</span><span style="color: #080;">&#40;</span><span style="color: #CC9900; font-weight: bold;">mtcars</span>, <span style="color: #080;">&#123;</span>
  <span style="color: #0000FF; font-weight: bold;">summary</span><span style="color: #080;">&#40;</span>mpg, disp, wt<span style="color: #080;">&#41;</span>
  <span style="color: #0000FF; font-weight: bold;">plot</span><span style="color: #080;">&#40;</span>mpg, disp<span style="color: #080;">&#41;</span>
  <span style="color: #0000FF; font-weight: bold;">plot</span><span style="color: #080;">&#40;</span>mpg, wt<span style="color: #080;">&#41;</span>
<span style="color: #080;">&#125;</span><span style="color: #080;">&#41;</span></pre></td></tr></table></div>

<p>In this case, the statements within the {} brackets are evaluated with reference to the mtcars data frame. You don’t have to worry about name conflicts here. If there’s only one statement (for example, summary(mpg)), the {} brackets are optional.</p>
<p>The limitation of the with() function is that assignments will only exist within the function brackets. Consider the following:</p>

<div class="wp_codebox"><table><tr id="p86540"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code" id="p865code40"><pre class="rsplus" style="font-family:monospace;"><span style="color: #080;">&gt;</span> <span style="color: #0000FF; font-weight: bold;">with</span><span style="color: #080;">&#40;</span><span style="color: #CC9900; font-weight: bold;">mtcars</span>, <span style="color: #080;">&#123;</span>
   stats <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">summary</span><span style="color: #080;">&#40;</span>mpg<span style="color: #080;">&#41;</span>
   stats
  <span style="color: #080;">&#125;</span><span style="color: #080;">&#41;</span>
   Min. 1st Qu. <span style="">Median</span> Mean 3rd Qu. <span style="">Max</span>.
  <span style="color: #ff0000;">10.40</span> <span style="color: #ff0000;">15.43</span> <span style="color: #ff0000;">19.20</span> <span style="color: #ff0000;">20.09</span> <span style="color: #ff0000;">22.80</span> <span style="color: #ff0000;">33.90</span>
<span style="color: #080;">&gt;</span> stats
Error<span style="color: #080;">:</span> object ‘stats’ not found</pre></td></tr></table></div>

<p>If you need to create objects that will exist outside of the with() construct, use the special assignment operator &lt;&lt;- instead of the standard one (&lt;-). It will save the object to the global environment outside of the with() call. This can be demonstrated with the following code:</p>

<div class="wp_codebox"><table><tr id="p86541"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code" id="p865code41"><pre class="rsplus" style="font-family:monospace;"><span style="color: #080;">&gt;</span> <span style="color: #0000FF; font-weight: bold;">with</span><span style="color: #080;">&#40;</span><span style="color: #CC9900; font-weight: bold;">mtcars</span>, <span style="color: #080;">&#123;</span>
   nokeepstats <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">summary</span><span style="color: #080;">&#40;</span>mpg<span style="color: #080;">&#41;</span>
   keepstats <span style="color: #080;">&lt;&lt;-</span> <span style="color: #0000FF; font-weight: bold;">summary</span><span style="color: #080;">&#40;</span>mpg<span style="color: #080;">&#41;</span>
<span style="color: #080;">&#125;</span><span style="color: #080;">&#41;</span>
<span style="color: #080;">&gt;</span> nokeepstats
Error<span style="color: #080;">:</span> object ‘nokeepstats’ not found
<span style="color: #080;">&gt;</span> keepstats
   Min. 1st Qu. <span style="">Median</span> Mean 3rd Qu. <span style="">Max</span>.
    <span style="color: #ff0000;">10.40</span> <span style="color: #ff0000;">15.43</span> <span style="color: #ff0000;">19.20</span> <span style="color: #ff0000;">20.09</span> <span style="color: #ff0000;">22.80</span> <span style="color: #ff0000;">33.90</span></pre></td></tr></table></div>

<p>Most books on R recommend using with() over attach(). I think that ultimately the choice is a matter of preference and should be based on what you’re trying to achieve and your understanding of the implications.</p>
<h3>Case identifiers</h3>
<p>In the patient data example, patientID is used to identify individuals in the dataset. In R, case identifiers can be specified with a rowname option in the data frame function. For example, the statement</p>

<div class="wp_codebox"><table><tr id="p86542"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p865code42"><pre class="rsplus" style="font-family:monospace;">patientdata <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">data.<span style="">frame</span></span><span style="color: #080;">&#40;</span>patientID, age, diabetes, status,
   <span style="color: #0000FF; font-weight: bold;">row.<span style="">names</span></span><span style="color: #080;">=</span>patientID<span style="color: #080;">&#41;</span></pre></td></tr></table></div>

<p>specifies patientID as the variable to use in labeling cases on various printouts and graphs produced by R.</p>
<h3>Summary</h3>
<p>One of the most challenging tasks in data analysis is data preparation. R provides various structures for holding data and many methods for importing data from both keyboard and external sources. One of those structures is data frames, which we covered here. Your ability to specify elements of these structures via the bracket notation is particularly important in selecting, subsetting, and transforming data.</p>
<p>R offers a wealth of functions for accessing external data. This includes data from flat files, web files, statistical packages, spreadsheets, and databases. Note that you can also export data from R into these external formats. We showed you how to use either the attach() and detach() or with() functions to simplify your code.</p>
<p><em>This article first appeared as chapter 2.2.4 from the &#8220;<a href="http://affiliate.manning.com/idevaffiliate.php?id=1205&#038;url=21">R in action</a><strong>&#8220;</strong> book, and is published with permission from <a href="http://affiliate.manning.com/idevaffiliate.php?id=1205">Manning publishing house</a>.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.r-statistics.com/2011/12/data-frame-objects-in-r-via-r-in-action/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>UseR! 2011 slides and videos &#8211; on one page</title>
		<link>http://www.r-statistics.com/2011/12/user-2011-slides-and-videos-on-one-page/</link>
		<comments>http://www.r-statistics.com/2011/12/user-2011-slides-and-videos-on-one-page/#comments</comments>
		<pubDate>Sun, 11 Dec 2011 22:15:31 +0000</pubDate>
		<dc:creator>Tal Galili</dc:creator>
				<category><![CDATA[R]]></category>
		<category><![CDATA[R community]]></category>
		<category><![CDATA[R links]]></category>
		<category><![CDATA[R talks]]></category>
		<category><![CDATA[useR]]></category>
		<category><![CDATA[useR 2011]]></category>

		<guid isPermaLink="false">http://www.r-statistics.com/?p=858</guid>
		<description><![CDATA[Links to slides and talks from useR 2011 - all organized in one page.]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:right;"><div class="socialize-in-button socialize-in-button-right"><iframe src="http://www.facebook.com/plugins/like.php?href=http://www.r-statistics.com/2011/12/user-2011-slides-and-videos-on-one-page/&amp;layout=box_count&amp;show_faces=false&amp;width=50&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px !important; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.r-statistics.com/2011/12/user-2011-slides-and-videos-on-one-page/"></g:plusone></div></div><p>I was recently <a href="http://applyr.blogspot.com/2011/12/user-2011-slides-are-available.html">reminded </a>that the wonderful team at warwick University made sure to put online many of the slides (and <a href="http://www.r-bloggers.com/RUG/category/user-conference/">some videos</a>) of talks from the recent <a href="http://www.warwick.ac.uk/statsdept/useR-2011/index.html">useR 2011</a> conference.  You can browse through the talks by going between the <a href="http://www.warwick.ac.uk/statsdept/user-2011/schedule/index.html">timetables</a> (where it will be the most updated, if more slides will be added later), but I thought it might be more convenient for some of you to have the links to all the talks (with slides/videos) in one place.</p>
<p>I am grateful for all of the wonderful people who put their time in making such an amazing event (organizers, speakers, attendees), and also for the many speakers who made sure to share their talk/slides online for all of us to reference.  I hope to see this open-slides trend will continue in the upcoming useR conferences&#8230;</p>
<p>Bellow are all the links:</p>
<p><span id="more-858"></span></p>
<p><strong>Tuesday 16th August</strong><strong></strong></p>
<div align="center">
<table border="1" cellpadding="0">
<tbody>
<tr>
<td>
<p align="center"><strong>09:50 &#8211; 10:50</strong></p>
</td>
<td colspan="2"><strong>Kaleidoscope Ia, MS.03, Chair: Dieter Menne</strong></td>
<td width="67"></td>
</tr>
<tr>
<td></td>
<td valign="top" width="197">Claudia Beleites</td>
<td valign="top" width="237"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/300311-beleitesclaudia.pdf">Spectroscopic Data in R and Validation of Soft Classifiers: Classifying Cells and Tissues by Raman Spectroscopy</a></td>
<td valign="top" width="67">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/16Aug_0950_Kaleid_Ia_1-Beleites.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="197">Jonathan Rosenblatt</td>
<td valign="top" width="237"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/310311-abstract_0-8.pdf">Revisiting Multi-Subject Random Effects in fMRI</a></td>
<td valign="top" width="67">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/16Aug_0950_Kaleid_Ia_1-Rosenblatt.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="197">Zoe Hoare</td>
<td valign="top" width="237"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/300311-hoarezoe.pdf">Putting the R into Randomisation</a></td>
<td valign="top" width="67">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/16Aug_0950_Kaleid_Ia_1-Hoare.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>Kaleidoscope Ib, MS.01, Chair: Simon Urbanek</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="197">Markus Gesmann</td>
<td valign="top" width="237"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/270211-gesmannmarkus.pdf">Using the Google Visualisation API with R</a></td>
<td valign="top" width="67">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/16Aug_0950_Kaleid_Ib_2-Gesmann.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>Kaleidoscope Ic, MS.02, Chair: Achim Zeileis</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="197">David Smith</td>
<td valign="top" width="237"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/010411-user2011_smith_r_ecosystem.pdf">The R Ecosystem</a></td>
<td valign="top" width="67">[<a href="http://prezi.com/s1qrgfm9ko4i/the-r-ecosystem/">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="197">E. James Harner</td>
<td valign="top" width="237"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/010411-rc2.pdf">Rc2: R collaboration in the cloud</a></td>
<td valign="top" width="67">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/16Aug_0950_Kaleid_Ic_2-Harner.pdf">Slides</a>]</td>
</tr>
<tr>
<td>
<p align="center"><strong>11:15 &#8211; 12:35</strong></p>
</td>
<td colspan="2"><strong>Portfolio Management, B3.02, Chair: Patrick Burns</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="197">Jagrata Minardi</td>
<td valign="top" width="237"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/040411-user2011_abstract_jm_01.pdf">R in the Practice of Risk Management Today</a></td>
<td valign="top" width="67">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/16Aug_1115_FocusI_1-PortfolioMgmt_1-Minardi.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>Bioinformatics and High-Throughput Data, B3.03, Chair: Hervé Pagès</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="197">Thierry Onkelinx</td>
<td valign="top" width="237"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/290311-onkelinxthierry.pdf">AFLP: generating objective and repeatable genetic data</a></td>
<td valign="top" width="67">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/16Aug_1115_FocusI_2-Bioinformatics_1-Onkelinx.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>High Performance Computing, MS.03, Chair: Stefan Theussl</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="197">Willem Ligtenberg</td>
<td valign="top" width="237"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/310311-gpu_computing_and_r.pdf">GPU computing and R</a></td>
<td valign="top" width="67">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/16Aug_1115_FocusI_3-HighPerfComp_1-Ligtenberg.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="197">Manuel Quesada</td>
<td valign="top" width="237"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/300311-user2011_obansoft.pdf">OBANSoft: integrated software for Bayesian statistics and high performance computing with R</a></td>
<td valign="top" width="67">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/16Aug_1115_FocusI_3-HighPerfComp_4-Quesada.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>Reporting Technologies and Workflows, MS.01, Chair: Martin Mächler</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="197">Andreas Leha</td>
<td valign="top" width="237"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/010411-lehaandreas.pdf">The Emacs Org-mode: Reproducible Research and Beyond</a></td>
<td valign="top" width="67">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/16Aug_1115_FocusI_4-ReportingWorkflows_3-Leha.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>Teaching, MS.02, Chair: Jay G. Kerns</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="197">Ian Holliday</td>
<td valign="top" width="237"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/310311-hollidayian.pdf">Teaching Statistics to Psychology Students using Reproducible Computing package RC and supporting Peer Review Framework</a></td>
<td valign="top" width="67">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/16Aug_1115_FocusI_5-Teaching_1-Holliday.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="197">Achim Zeileis</td>
<td valign="top" width="237"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/270311-abstract.pdf">Automatic generation of exams in R</a></td>
<td valign="top" width="67">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/16Aug_1115_FocusI_5-Teaching_3-Zeileis.pdf">Slides</a>]</td>
</tr>
<tr>
<td>
<p align="center"><strong>14:00 &#8211; 14:45</strong></p>
</td>
<td colspan="2"><strong>Invited Talk, MS.01/MS.02, Chair: David Firth</strong></td>
<td></td>
</tr>
<tr>
<td valign="top" width="77"></td>
<td valign="top" width="197">Ulrike Grömping</td>
<td valign="top" width="237"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/invited/user2011_Groemping.pdf">Design of Experiments in R</a></td>
<td valign="top" width="67">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Invited/Gromping-Design_of_Experiments.pdf">Slides</a>] [<a href="http://www.r-bloggers.com/RUG/2011/10/user-2011-ulrike-gromping-design-of-experiments/">Video</a>]</td>
</tr>
<tr>
<td>
<p align="center"><strong>14:45 &#8211; 15:30</strong></p>
</td>
<td colspan="2"><strong>Invited Talk, MS.01/MS.02, Chair: David Firth</strong></td>
<td></td>
</tr>
<tr>
<td valign="top" width="77"></td>
<td valign="top" width="197">Jonathan Rougier</td>
<td valign="top" width="237"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/invited/user2011_Rougier.pdf">Nomograms for visualising relationships between three variables</a></td>
<td valign="top" width="67">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Invited/Rougier_Nomograms.pdf">Slides</a>] [<a href="http://www.r-bloggers.com/RUG/2011/10/user-2011-jonathan-rougier-nomograms-for-visualising-relationships-between-three-variables/">Video</a>]</td>
</tr>
<tr>
<td>
<p align="center"><strong>16:00 &#8211; 17:00</strong></p>
</td>
<td colspan="2"><strong>Modelling Systems and Networks, B3.02, Chair: Jonathan Rougier</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="197">Rachel Oxlade</td>
<td valign="top" width="237"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/100311-oxladerachel.pdf">An S4 Object structure for emulation &#8211; the approximation of complex functions</a></td>
<td valign="top" width="67">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/16Aug_1600_FocusII_1-ModelSysNet_1-Oxlade.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="197">Christophe Dutang</td>
<td valign="top" width="237"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/290311-dutangchristophe.pdf">Computation of generalized Nash equilibria</a></td>
<td valign="top" width="67">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/16Aug_1600_FocusII_1-ModellingSystemsNet_3-Dutang.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>Visualisation, MS.04, Chair: Antony Unwin</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="197">Andrej Blejec</td>
<td valign="top" width="237"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/310311-blejecandrej.pdf">animatoR: dynamic graphics in R</a></td>
<td valign="top" width="67">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/16Aug_1600_FocusII_3-Visual_1-Blejec.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="197">Richard M. Heiberger</td>
<td valign="top" width="237"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/240311-heibergerrichard.pdf">Graphical Syntax for Structables and their Mosaic Plots</a></td>
<td valign="top" width="67">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/16Aug_1600_FocusII_3-Visual_2-Heiberger.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>Dimensionality Reduction and Variable Selection, MS.01, Chair: Matthias Schmid</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="197">Marie Chavent</td>
<td valign="top" width="237"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/310311-chaventmarie.pdf">ClustOfVar: an R package for the clustering of variables</a></td>
<td valign="top" width="67">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/16Aug_1600_FocusII_5-DimReduction_1-Chavent.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="197">Jürg Schelldorfer</td>
<td valign="top" width="237"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/290311-glmmlasso.pdf">Variable Screening and Parameter Estimation for High-Dimensional Generalized Linear Mixed Models Using l1-Penalization</a></td>
<td valign="top" width="67">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/16Aug_1600_FocusII_5-DimReduction_2-Schelldorfer.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="197">Benjamin Hofner</td>
<td valign="top" width="237"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/010411-hofnerbenjamin.pdf">gamboostLSS: boosting generalized additive models for location, scale and shape</a></td>
<td valign="top" width="67">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/16Aug_1600_FocusII_5-DimReduction_3-Hofner.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>Business Management, MS.02, Chair: Enrico Branca</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="197">Marlene S. Marchena</td>
<td valign="top" width="237"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/100311-marchenamarlene.pdf">SCperf: An inventory management package for R</a></td>
<td valign="top" width="67">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/16Aug_1600_FocusII_6-Business_1-Marchena.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="197">Pairach Piboonrungroj</td>
<td valign="top" width="237"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/080211-user2011_using_r_to_test_tce_in_tsc_sem.pdf">Using R to test transaction cost measurement for supply chain relationship: A structural equation model</a></td>
<td valign="top" width="67">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/16Aug_1600_FocusII_6-Business_2-Piboonrungroj.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="197">Fabrizio Ortolani</td>
<td valign="top" width="237"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/040411-millo_ortolani.pdf">Integrating R and Excel for automatic business forecasting</a></td>
<td></td>
</tr>
<tr>
<td>
<p align="center"><strong>17:05 &#8211; 18:05</strong></p>
</td>
<td colspan="2"><a href="http://www.warwick.ac.uk/statsdept/user-2011/schedule/lightning.html"><strong>Lightning Talks</strong></a></td>
<td>(see bellow)</td>
</tr>
</tbody>
</table>
</div>
<div align="center">
<hr align="center" noshade="noshade" size="2" width="100%" />
</div>
<p><strong>Lightning Talks</strong></p>
<ul>
<li>Community and Communication, MS.02, Chair: Ashley Ford</li>
<ul>
<li><strong style="font-size: 13px;">George Zhang:</strong><strong style="font-size: 13px;"> </strong><span class="Apple-style-span" style="font-size: 13px; font-weight: normal;">China R user conference [</span><a style="font-size: 13px; font-weight: normal;" href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Lightening/1-CommunityAndCommun_3-Zhang.pdf">Slides</a><span class="Apple-style-span" style="font-size: 13px; font-weight: normal;">]</span></li>
<li><strong style="font-size: 13px;">Tal Galili:</strong><strong style="font-size: 13px;"> </strong><span class="Apple-style-span" style="font-size: 13px; font-weight: normal;">Blogging and R &#8211; present and future [</span><a style="font-size: 13px; font-weight: normal;" href="http://www.r-statistics.com/2011/10/the-present-and-future-of-the-r-blogosphere-a-7-minute-lightning-talk-from-user2011/">Link</a><span class="Apple-style-span" style="font-size: 13px; font-weight: normal;">]</span></li>
<li><strong style="font-size: 13px;">Markus Schmidberger:</strong><strong style="font-size: 13px;"> </strong><span class="Apple-style-span" style="font-size: 13px; font-weight: normal;">Get your R application onto a powerful and fully-configured Cloud Computing environment in less than 5 minutes. [</span><a style="font-size: 13px; font-weight: normal;" href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Lightening/1-CommunityAndCommun_7-Schmidberger.pdf">Slides</a><span class="Apple-style-span" style="font-size: 13px; font-weight: normal;">]</span></li>
<li><strong style="font-size: 13px;">Eirini Koutoumanou:</strong><strong style="font-size: 13px;"> </strong><span class="Apple-style-span" style="font-size: 13px; font-weight: normal;">Teaching R to Non Package Literate Users [</span><a style="font-size: 13px; font-weight: normal;" href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Lightening/1-CommunityAndCommunication_9-Koutoumanou.pdf">Slides</a><span class="Apple-style-span" style="font-size: 13px; font-weight: normal;">]</span></li>
<li><strong style="font-size: 13px;">Randall Pruim:</strong><strong style="font-size: 13px;"> </strong><span class="Apple-style-span" style="font-size: 13px; font-weight: normal;">Teaching Statistics using the mosaic Package [</span><a style="font-size: 13px; font-weight: normal;" href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Lightening/1-CommunityAndCommun_10-Prium.pdf">Slides</a><span class="Apple-style-span" style="font-size: 13px; font-weight: normal;">]</span></li>
</ul>
<li>Statistics and Programming, MS.01, Chair: Elke Thönnes</li>
<ul>
<li><strong style="font-size: 13px;">Toby Dylan Hocking:</strong><strong style="font-size: 13px;"> </strong><span class="Apple-style-span" style="font-size: 13px; font-weight: normal;">Fast, named capture regular expressions in R2.14 [</span><a style="font-size: 13px; font-weight: normal;" href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Lightening/2-StatisticsAndProg_3-Hocking.pdf">Slides</a><span class="Apple-style-span" style="font-size: 13px; font-weight: normal;">]</span></li>
<li><strong style="font-size: 13px;">John C. Nash:</strong><strong style="font-size: 13px;"> </strong><span class="Apple-style-span" style="font-size: 13px; font-weight: normal;">Developments in optimization tools for R [</span><a style="font-size: 13px; font-weight: normal;" href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Lightening/2-StatisticsAndProg_4-Nash.pdf">Slides</a><span class="Apple-style-span" style="font-size: 13px; font-weight: normal;">]</span></li>
<li><strong style="font-size: 13px;">Christophe Dutang:</strong><strong style="font-size: 13px;"> </strong><span class="Apple-style-span" style="font-size: 13px; font-weight: normal;">A Unified Approach to fit probability distributions [</span><a style="font-size: 13px; font-weight: normal;" href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Lightening/2-StatisticsAndProg_5-Dutang.pdf">Slides</a><span class="Apple-style-span" style="font-size: 13px; font-weight: normal;">]</span></li>
</ul>
<li>Package Showcase, MS.03, Chair: Jennifer Rogers</li>
<ul>
<li><strong style="font-size: 13px;">James Foadi:</strong><strong style="font-size: 13px;"> </strong><span class="Apple-style-span" style="font-size: 13px; font-weight: normal;">cRy: statistical applications in macromolecular crystallography [</span><a style="font-size: 13px; font-weight: normal;" href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Lightening/3-PackageShowcase_3-Foadi.pdf">Slides</a><span class="Apple-style-span" style="font-size: 13px; font-weight: normal;">]</span></li>
<li><strong style="font-size: 13px;">Emilio López:</strong><strong style="font-size: 13px;"> </strong><span class="Apple-style-span" style="font-size: 13px; font-weight: normal;">Six Sigma is possible with R [</span><a style="font-size: 13px; font-weight: normal;" href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Lightening/3-PackageShowcase_5-Lopez.pdf">Slides</a><span class="Apple-style-span" style="font-size: 13px; font-weight: normal;">]</span></li>
<li><strong style="font-size: 13px;">Jonathan Clayden:</strong><strong style="font-size: 13px;"> </strong><span class="Apple-style-span" style="font-size: 13px; font-weight: normal;">Medical image processing with TractoR [</span><a style="font-size: 13px; font-weight: normal;" href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Lightening/3-PackageShowcase_6-Clayden.pdf">Slides</a><span class="Apple-style-span" style="font-size: 13px; font-weight: normal;">]</span></li>
<li><strong style="font-size: 13px;">Richard A. Bilonick:</strong><strong style="font-size: 13px;"> </strong><span class="Apple-style-span" style="font-size: 13px; font-weight: normal;">Using merror 2.0 to Analyze Measurement Error and Determine Calibration Curves [</span><a style="font-size: 13px; font-weight: normal;" href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Lightening/3-PackageShowcase_8-Bilonick.pdf">Slides</a><span class="Apple-style-span" style="font-size: 13px; font-weight: normal;">]</span></li>
</ul>
</ul>
<p><strong>Wednesday 17th August</strong></p>
<div align="center">
<table border="1" cellpadding="0">
<tbody>
<tr>
<td>
<p align="center"><strong>09:00 &#8211; 09:50</strong></p>
</td>
<td colspan="2"><strong>Invited Talk, MS.01/MS.02, Chair: Ioannis Kosmidis</strong></td>
<td width="52"></td>
</tr>
<tr>
<td valign="top" width="88"></td>
<td valign="top" width="136">Lee E. Edlefsen</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/invited/user2011_Edlefsen.pdf">Scalable Data Analysis in R</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Invited/Edlefsen-Scalable_Data_Analysis.pdf">Slides</a>] [<a href="http://www.r-bloggers.com/RUG/2011/10/user-2011-lee-e-edlefsen-scalable-data-analysis-in-r/">Video</a>]</td>
</tr>
<tr>
<td>
<p align="center"><strong>11:15 &#8211; 12:35</strong></p>
</td>
<td colspan="2"><strong>Spatio-Temporal Statistics, B3.02, Chair: Julian Stander</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">Nikolaus Umlauf</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/310311-umlaufnikolaus.pdf">Structured Additive Regression Models: An R Interface to BayesX</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1115_FocusIII_1-SpatioTempStat_3-Umlauf.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>Molecular and Cell Biology, B3.03, Chair: Andrea Foulkes</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">Matthew Nunes</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/170211-nunesmatthew.pdf">Summary statistics selection for ABC inference in R</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1115_FocusIII_2-MolecCellBio_3-Nunes.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">Maarten van Iterson</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/070311-user2011_vaniterson.pdf">Power and minimal sample size for multivariate analysis of microarrays</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1115_FocusIII_2-MolecCellBio_4-vanIterson.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>Mixed Effect Models, MS.03, Chair: Douglas Bates</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">Ulrich Halekoh</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/290311-halekohulrich.pdf">Kenward-Roger modification of the F-statistic for some linear mixed models fitted with lmer</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1115_FocusIII_3-MixedEffects_1-Halekoh.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">Marco Geraci</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/280311-geracimarco.pdf">lqmm: Estimating Quantile Regression Models for Independent and Hierarchical Data with R</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1115_FocusIII-2-Geraci.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">Kenneth Knoblauch</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/030411-knoblauchken.pdf">Mixed-effects Maximum Likelihood Difference Scaling</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1115_FocusIII_3-MixedEffects_4-Knoblauch.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>Programming, MS.01, Chair: Uwe Ligges</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">Ray Brownrigg</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/140111-brownriggray.pdf">Tricks and Traps for Young Players</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1115_FocusIII_4-Programming_1-Brownrigg.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">Friedrich Schuster</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/300311-user2011_abstract_patterns_en.pdf">Software design patterns in R</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1115_FocusIII_4-Programming_2-Schuster.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">Patrick Burns</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/300311-burnspatrick.pdf">Random input testing with R</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1115_FocusIII_4-Programming_2-Burns.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>Data Mining Applications, MS.02, Chair: Przemys</strong><strong>aw Biecek</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">Stephan Stahlschmidt</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/310311-stahlschmidt_abstract.pdf">Predicting the offender&#8217;s age</a></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">Daniel Chapsky</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/110311-chapskydaniel.pdf">Leveraging Online Social Network Data and External Data Sources to Predict Personality</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1115_FocusIII_5-DataMining_2-Chapsky.pdf">Slides</a>]</td>
</tr>
<tr>
<td>
<p align="center"><strong>14:45 &#8211; 15:30</strong></p>
</td>
<td colspan="2"><strong>Invited Talk, MS.01/MS.02, Chair: John Aston</strong></td>
<td></td>
</tr>
<tr>
<td valign="top" width="88"></td>
<td valign="top" width="136">Brandon Whitcher</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/invited/user2011_Whitcher.pdf">Quantitative Medical Image Analysis</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Invited/Whitcher-Quantitative_Medical_Image_Analysis.pdf">Slides</a>] [<a href="http://www.r-bloggers.com/RUG/2011/10/user-2011-brandon-whitcher-quantitative-medical-image-analysis/">Video</a>]</td>
</tr>
<tr>
<td>
<p align="center"><strong>16:00 &#8211; 17:00</strong></p>
</td>
<td colspan="2"><strong>Development of R, B3.02, Chair: John C. Nash</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">Andrew R. Runnalls</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/010411-runnallsandrew.pdf">Interpreter Internals: Unearthing Buried Treasure with CXXR</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1600_FocusIV_1-DevelOfR_2-Runnalls.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>Geospatial Techniques, B3.03, Chair: Roger Bivand</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">Binbin Lu</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/110311-transform_a_spatial_network_to_a_graph_in_r.pdf">Converting a spatial network to a graph in R</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1600_FocusIV_2-Geospatial_1-Lu.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">Rainer M Krug</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/010411-krugrainerm.pdf">Spatial modelling with the R-GRASS Interface</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1600_FocusIV_2-Geospatial_2-Krug.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">Daniel Nüst</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/210211-nuestdaniel.pdf">sos4R &#8211; Accessing SensorWeb Data from R</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1600_FocusIV_2-Geospatial_3-Nust.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>Genomics and Bioinformatics, MS.03, Chair: Ramón Diaz-Uriarte</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">Sebastian Gibb</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/280311-gibbsebastian.pdf">MALDIquant: Quantitative Analysis of MALDI-TOF Proteomics Data</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1600_FocusIV_3-Genomics_1-Gibb.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>Regression Modelling, MS.01, Chair: Cristiano Varin</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">Bettina Grün</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/210311-zeileisgruencribari-neto.pdf">Beta Regression: Shaken, Stirred, Mixed, and Partitioned</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1600_FocusIV_4-Regression_1-Grun.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">Rune Haubo B. Christensen</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/310311-christensenrune.pdf">Regression Models for Ordinal Data: Introducing R-package ordinal</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1600_FocusIV_4-Regression_2-Haubo.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">Giuseppe Bruno</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/280311-brunogiuseppe.pdf">Multiple choice models: why not the same answer? A comparison among LIMDEP, R, SAS and Stata</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1600_FocusIV_4-Regression_3-Bruno.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>R in the Business World, MS.02, Chair: David Smith</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">Derek McCrae Norton</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/310311-norton_user2011_abstract.pdf">Odysseus vs. Ajax: How to build an R presence in a corporate SAS environment</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1600_FocusIV_5-RinBusiness_1-Norton.pdf">Slides</a>]</td>
</tr>
<tr>
<td>
<p align="center"><strong>17:05 &#8211; 18:05</strong></p>
</td>
<td colspan="2"><strong>Hydrology and Soil Science, B3.02, Chair: Thomas Petzoldt</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">Wayne Jones</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/220311-jones_wayne.pdf">GWSDAT (GroundWater Spatiotemporal Data Analysis Tool)</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1705_FocusV_1-Hydrology_1-Jones.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">Pierre Roudier</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/040411-roudierpierre.pdf">Visualisation and modelling of soil data using the aqp package</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1705_FocusV_1-Hydrology_3-Roudier.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>Biostatistical Modelling, B3.03, Chair: Holger Hoefling</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">Annamaria Guolo</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/310311-guolo-varin.pdf">Higher-order likelihood inference in meta-analysis using R</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1705_FocusV_2-Biostat_2-Guolo.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">Cristiano Varin</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/310311-masarotto-varin.pdf">Gaussian copula regression using R</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1705_FocusV_2-Biostat_3-Varin.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>Psychometrics, MS.03, Chair: Yves Rosseel</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">Florian Wickelmaier</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/020411-wickelmaierflorian.pdf">Multinomial Processing Tree Models in R</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1705_FocusV_3-Psychometrics_1-Wickelmaier.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">Basil Abou El-Komboz</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/290311-abstract_psychotree.pdf">Detecting Invariance in Psychometric Models with the psychotree Package</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1705_FocusV_3-Psychometrics_2-ElKomboz.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>Multivariate Data, MS.01, Chair: Peter Dalgaard</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">John Fox</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/220111-user2011_john-fox.pdf">Tests for Multivariate Linear Models with the car Package</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1705_FocusV_4-Multivariate_1-Fox.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">Julie Josse</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/140311-jossejulie.pdf">missMDA: a package to handle missing values in and with multivariate exploratory data analysis methods</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1705_FocusV_4-Multivariate_2-Josse.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">António Pedro Duarte Silva</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/310311-user2011_dsilva_brito.pdf">MAINT.DATA: Modeling and Analysing Interval Data in R</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1705_FocusV_4-Multivariate_3-Silva.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>Interfaces, MS.02, Chair: Matthew Shotwell</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">Xavier de Pedro Puente</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/030411-depedroxavier_sanchezalex.pdf">Web 2.0 for R scripts and workflows: Tiki and PluginR</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1705_FocusV_5-Interfaces_1-dePedro.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="136">Sheri Gilley</td>
<td valign="top" width="302"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/010411-user2011_gilley_a_new_gui_for_r.pdf">A new task-based GUI for R</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/17Aug_1705_FocusV_5-Interfaces_3-Gilley.pdf">Slides</a>]</td>
</tr>
</tbody>
</table>
</div>
<p><strong>Thursday 18th August</strong></p>
<div align="center">
<table border="1" cellpadding="0">
<tbody>
<tr>
<td>
<p align="center"><strong>09:00 &#8211; 09:45</strong></p>
</td>
<td colspan="2"><strong>Invited Talk, MS.01/MS.02, Chair: Julia Brettschneider</strong></td>
<td width="52"></td>
</tr>
<tr>
<td valign="top" width="76"></td>
<td valign="top" width="188">Wolfgang Huber</td>
<td valign="top" width="261"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/invited/user2011_Huber.pdf">Genomes and phenotypes</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Invited/Huber-Genomes_and_phenotypes.pdf">Slides</a>] [<a href="http://www.r-bloggers.com/RUG/2011/10/http:/www.r-bloggers.com/RUG/2011/10/user-2011-wolfgang-huber-genomes-and-phenotypes/">Video</a>]</td>
</tr>
<tr>
<td>
<p align="center"><strong>09:50 &#8211; 10:50</strong></p>
</td>
<td colspan="2"><strong>Financial Models, B3.02, Chair: Giovanni Petris</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="188">Peter Ruckdeschel</td>
<td valign="top" width="261"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/300311-ruckdeschelpeter.pdf">(Robust) Online Filtering in Regime Switching Models and Application to Investment Strategies for Asset Allocation</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/18Aug_0950_FocusVI_1-Finance_3-Ruckdeschel.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>Ecology and Ecological Modelling, B3.03, Chair: Karline Soetaert</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="188">Christian Kampichler</td>
<td valign="top" width="261"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/310311-kampichlerchristian.pdf">Using R for the Analysis of Bird Demography on a Europe-wide Scale</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/18Aug_0950_FocusVI_2-Ecology_1-Kampichler.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="188">John C. Nash</td>
<td valign="top" width="261"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/140311-nashjohnc.pdf">An effort to improve nonlinear modeling practice</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/18Aug_0950_FocusVI_2-Ecology_3-Nash.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>Generalized Linear Models, MS.03, Chair: Kenneth Knoblauch</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="188">Ioannis Kosmidis</td>
<td valign="top" width="261"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/040411-kosmidisioannis.pdf">brglm: Bias reduction in generalized linear models</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/18Aug_0950_FocusVI_3-GLM-3-Kosmidis.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="188">Merete K. Hansen</td>
<td valign="top" width="261"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/310311-hansenmerete.pdf">The binomTools package: Performing model diagnostics on binomial regression models</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/18Aug_0950_FocusVI_3-GLM-3_Hansen.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>Reporting Data, MS.01, Chair: Martyn Plummer</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="188">Sina Rüeger</td>
<td valign="top" width="261"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/230311-rueegersina.pdf">uniPlot &#8211; A package to uniform and customize R graphics</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/18Aug_0950_FocusVI_4-ReportingData_1-Rueger.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="188">Alexander Kowarik</td>
<td valign="top" width="261"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/110211-kowarikalexander.pdf">sparkTable: Generating Graphical Tables for Websites and Documents with R</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/18Aug_0950_FocusVI_4-ReportingData_2-Kowarik.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="188">Isaac Subirana</td>
<td valign="top" width="261"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/010411-subiranaisaac.pdf">compareGroups package, updated and improved</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/18Aug_0950_FocusVI_4-ReportingData_3-Subirana.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>Process Optimization, MS.02, Chair: Tobias Verbeke</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="188">Emilio López</td>
<td valign="top" width="261"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/300311-lopezemilio.pdf">Six Sigma Quality Using R: Tools and Training</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/18Aug_0950_FocusVI_5-ProcessOptimization_1-Lopez.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="188">Thomas Roth</td>
<td valign="top" width="261"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/010411-roththomas2.pdf">Process Performance and Capability Statistics for Non-Normal Distributions in R</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/18Aug_0950_FocusVI_5-ProcessOptimization_2-Roth.pdf">Slides</a>]</td>
</tr>
<tr>
<td>
<p align="center"><strong>11:15 &#8211; 12:35</strong></p>
</td>
<td colspan="2"><strong>Inference, B3.02, Chair: Peter Ruckdeschel</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="188">Henry Deng</td>
<td valign="top" width="261"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/260111-denghenry.pdf">Density Estimation Packages in R</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/18Aug_1115_FocusVII_1-Inference_1-Deng.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>Population Genetics and Genetics Association Studies, B3.03, Chair: Martin Morgan</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="188">Benjamin French</td>
<td valign="top" width="261"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/160311-frenchbenjamin.pdf">Simple haplotype analyses in R</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/18Aug_1115_FocusVII_2-PopuGenetics_1-French.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>Neuroscience, MS.03, Chair: Brandon Whitcher</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="188">Karsten Tabelow</td>
<td valign="top" width="261"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/310311-user2011_fmri.pdf">Statistical Parametric Maps for Functional MRI Experiments in R: The Package fmri</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/18Aug_1115_FocusVII_3-Neuroscience_2-Tabelow.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>Data Management, MS.01, Chair: Barry Rowlingson</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="188">Susan Ranney</td>
<td valign="top" width="261"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/010411-ranneysusan.pdf">It&#8217;s a Boy! An Analysis of Tens of Millions of Birth Records Using R</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/18Aug_1115_FocusVII_4-DataMgmt_1-Ranney.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="188">Joanne Demmler</td>
<td valign="top" width="261"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/290311-demmlerjoanne.pdf">Challenges of working with a large database of routinely collected health data: Combining SQL and R</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/18Aug_1115_FocusVII_4-DataMgmt_2-Demmler.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>Interactive Graphics in R, MS.02, Chair: Paul Murrell</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="188">Richard Cotton</td>
<td valign="top" width="261"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/310311-cottonrichard.pdf">Easy Interactive ggplots</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/18Aug_1115_FocusVII_5-InteractiveGraphics_3-Cotton.pdf">Slides</a>]</td>
</tr>
<tr>
<td>
<p align="center"><strong>14:00 &#8211; 15:00</strong></p>
</td>
<td colspan="2"><strong>Kaleidoscope IIIa, MS.03, Chair: Adrian Bowman</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="188">Thomas Petzoldt</td>
<td valign="top" width="261"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/010411-petzoldtthomas.pdf">Using R for systems understanding &#8211; a dynamic approach</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/18Aug_1400_KaleidIIIa_1-Petzoldt.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="188">David L. Miller</td>
<td valign="top" width="261"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/280311-millerdavid.pdf">Using multidimensional scaling with Duchon splines for reliable finite area smoothing</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/18Aug_1400_KaleidIIIa_2-Miller.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td valign="top" width="188">Alastair Sanderson</td>
<td valign="top" width="261"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/300311-sandersonalastair.pdf">Studying galaxies in the nearby Universe, using R and ggplot2</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/18Aug_1400_KaleidIIIa_3-Sanderson.pdf">Slides</a>]</td>
</tr>
<tr>
<td></td>
<td colspan="2"><strong>Kaleidoscope IIIb, MS.02, Chair: Frank Harrell</strong></td>
<td></td>
</tr>
<tr>
<td></td>
<td valign="top" width="188">Paul Murrell</td>
<td valign="top" width="261"><a href="http://www.warwick.ac.uk/statsdept/useR-2011/abstracts/060211-processing.pdf">Vector Image Processing</a></td>
<td valign="top" width="52">[<a href="http://www.warwick.ac.uk/statsdept/user-2011/TalkSlides/Contributed/18Aug_1400_KaleidIIIb_2-Murrell.pdf">Slides</a>]</td>
</tr>
</tbody>
</table>
</div>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.r-statistics.com/2011/12/user-2011-slides-and-videos-on-one-page/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Diagram for a Bernoulli process (using R)</title>
		<link>http://www.r-statistics.com/2011/11/diagram-for-a-bernoulli-process-using-r/</link>
		<comments>http://www.r-statistics.com/2011/11/diagram-for-a-bernoulli-process-using-r/#comments</comments>
		<pubDate>Thu, 10 Nov 2011 12:44:41 +0000</pubDate>
		<dc:creator>Tal Galili</dc:creator>
				<category><![CDATA[R]]></category>
		<category><![CDATA[statistics]]></category>
		<category><![CDATA[visualization]]></category>
		<category><![CDATA[Bernoulli process]]></category>
		<category><![CDATA[binomial distribution]]></category>
		<category><![CDATA[distribution]]></category>
		<category><![CDATA[statistical distribution]]></category>

		<guid isPermaLink="false">http://www.r-statistics.com/?p=829</guid>
		<description><![CDATA[A Bernoulli process is a sequence of Bernoulli trials (the realization of n binary random variables), taking two values (0/1, Heads/Tails, Boy/Girl, etc&#8230;). It is often used in teaching introductory probability/statistics classes about the binomial distribution. When visualizing a Bernoulli process, it is common to use a binary tree diagram in order to show the [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:right;"><div class="socialize-in-button socialize-in-button-right"><iframe src="http://www.facebook.com/plugins/like.php?href=http://www.r-statistics.com/2011/11/diagram-for-a-bernoulli-process-using-r/&amp;layout=box_count&amp;show_faces=false&amp;width=50&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px !important; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.r-statistics.com/2011/11/diagram-for-a-bernoulli-process-using-r/"></g:plusone></div></div><p>A Bernoulli process is a sequence of Bernoulli trials (the realization of n binary random variables), taking two values (0/1, Heads/Tails, Boy/Girl, etc&#8230;).  It is often used in teaching introductory probability/statistics classes about the binomial distribution.</p>
<p>When visualizing a Bernoulli process, it is common to use a binary tree diagram in order to show the progression of the process, as well as the various consequences of the trial.  We might also include the number of &#8220;successes&#8221;, and the probability for reaching a specific terminal node.</p>
<p>I wanted to be able to create such a diagram using R.  For this purpose I composed some code which uses the {<a href="http://cran.r-project.org/web/packages/diagram/">diagram</a>} R package.  The final function should allow one to create different sizes of diagrams, while allowing flexibility with regards to the text which is used in the tree.</p>
<p>Here is an example of the simplest use of the function:</p>

<div class="wp_codebox"><table><tr id="p82946"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p829code46"><pre class="rsplus" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">source</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;http://www.r-statistics.com/wp-content/uploads/2011/11/binary.tree_.for_.binomial.game_.r.txt&quot;</span><span style="color: #080;">&#41;</span> <span style="color: #228B22;"># loading the function</span>
binary.<span style="">tree</span>.<span style="">for</span>.<span style="">binomial</span>.<span style="">game</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">2</span><span style="color: #080;">&#41;</span> <span style="color: #228B22;"># creating a tree for B(2,0.5)</span></pre></td></tr></table></div>

<p>The resulting diagram will look like this:</p>
<p><a href="http://www.r-statistics.com/wp-content/uploads/2011/11/binary.tree_.for_.binomial.game001.png"><img src="http://www.r-statistics.com/wp-content/uploads/2011/11/binary.tree_.for_.binomial.game001-300x257.png" alt="" title="binary.tree.for.binomial.game001" width="300" height="257" class="alignnone size-medium wp-image-832" /></a></p>
<p>The same can be done for creating larger trees.  For example, here is the code for a 4 stage Bernoulli process:</p>

<div class="wp_codebox"><table><tr id="p82947"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p829code47"><pre class="rsplus" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">source</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;http://www.r-statistics.com/wp-content/uploads/2011/11/binary.tree_.for_.binomial.game_.r.txt&quot;</span><span style="color: #080;">&#41;</span> <span style="color: #228B22;"># loading the function</span>
binary.<span style="">tree</span>.<span style="">for</span>.<span style="">binomial</span>.<span style="">game</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">4</span><span style="color: #080;">&#41;</span> <span style="color: #228B22;"># creating a tree for B(4,0.5)</span></pre></td></tr></table></div>

<p>The resulting diagram will look like this:</p>
<p><a href="http://www.r-statistics.com/wp-content/uploads/2011/11/binary.tree_.for_.binomial.game-BIG.png"><img src="http://www.r-statistics.com/wp-content/uploads/2011/11/binary.tree_.for_.binomial.game-BIG-300x150.png" alt="" title="binary.tree.for.binomial.game - BIG" width="300" height="150" class="alignnone size-medium wp-image-830" /></a></p>
<p>The function can also be tweaked in order to describe a more specific story.  For example, the following code describes a 3 stage Bernoulli process where an unfair coin is tossed 3 times (with probability of it giving heads being 0.8):</p>

<div class="wp_codebox"><table><tr id="p82948"><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p829code48"><pre class="rsplus" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">source</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;http://www.r-statistics.com/wp-content/uploads/2011/11/binary.tree_.for_.binomial.game_.r.txt&quot;</span><span style="color: #080;">&#41;</span> <span style="color: #228B22;"># loading the function</span>
binary.<span style="">tree</span>.<span style="">for</span>.<span style="">binomial</span>.<span style="">game</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">3</span>, <span style="color: #ff0000;">0.8</span>, first_box_text <span style="color: #080;">=</span> <span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;Tossing an unfair coin&quot;</span>, <span style="color: #ff0000;">&quot;(3 times)&quot;</span><span style="color: #080;">&#41;</span>, left_branch_text <span style="color: #080;">=</span> <span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;Failure&quot;</span>, <span style="color: #ff0000;">&quot;Playing again&quot;</span><span style="color: #080;">&#41;</span>, right_branch_text <span style="color: #080;">=</span> <span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;Success&quot;</span>, <span style="color: #ff0000;">&quot;Playing again&quot;</span><span style="color: #080;">&#41;</span>, 
    left_leaf_text <span style="color: #080;">=</span> <span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;Failure&quot;</span>, <span style="color: #ff0000;">&quot;Game ends&quot;</span><span style="color: #080;">&#41;</span>, right_leaf_text <span style="color: #080;">=</span> <span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;Success&quot;</span>, 
        <span style="color: #ff0000;">&quot;Game ends&quot;</span><span style="color: #080;">&#41;</span>, cex <span style="color: #080;">=</span> <span style="color: #ff0000;">0.8</span>, rescale_radx <span style="color: #080;">=</span> <span style="color: #ff0000;">1.2</span>, rescale_rady <span style="color: #080;">=</span> <span style="color: #ff0000;">1.2</span>, 
    box_color <span style="color: #080;">=</span> <span style="color: #ff0000;">&quot;lightgrey&quot;</span>, shadow_color <span style="color: #080;">=</span> <span style="color: #ff0000;">&quot;darkgrey&quot;</span>, left_arrow_text <span style="color: #080;">=</span> <span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;Tails <span style="color: #000099; font-weight: bold;">\n</span>(P = 0.2)&quot;</span><span style="color: #080;">&#41;</span>, 
    right_arrow_text <span style="color: #080;">=</span> <span style="color: #0000FF; font-weight: bold;">c</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;Heads <span style="color: #000099; font-weight: bold;">\n</span>(P = 0.8)&quot;</span><span style="color: #080;">&#41;</span>, distance_from_arrow <span style="color: #080;">=</span> <span style="color: #ff0000;">0.04</span><span style="color: #080;">&#41;</span></pre></td></tr></table></div>

<p>The resulting diagram is:</p>
<p><a href="http://www.r-statistics.com/wp-content/uploads/2011/11/binary.tree_.for_.binomial.game002.png"><img src="http://www.r-statistics.com/wp-content/uploads/2011/11/binary.tree_.for_.binomial.game002-300x257.png" alt="" title="binary.tree.for.binomial.game002" width="300" height="257" class="alignnone size-medium wp-image-833" /></a></p>
<p>If you make up neat examples of using the code (or happen to find a bug), or for any other reason &#8211; you are <strong>welcome to leave a comment</strong>.</p>
<p>(note: the images above are licensed under CC BY-SA)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.r-statistics.com/2011/11/diagram-for-a-bernoulli-process-using-r/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>The present and future of the R blogosphere (~7 minute video from useR2011)</title>
		<link>http://www.r-statistics.com/2011/10/the-present-and-future-of-the-r-blogosphere-a-7-minute-lightning-talk-from-user2011/</link>
		<comments>http://www.r-statistics.com/2011/10/the-present-and-future-of-the-r-blogosphere-a-7-minute-lightning-talk-from-user2011/#comments</comments>
		<pubDate>Sun, 30 Oct 2011 16:08:59 +0000</pubDate>
		<dc:creator>Tal Galili</dc:creator>
				<category><![CDATA[R]]></category>
		<category><![CDATA[R and the web]]></category>
		<category><![CDATA[R community]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[Blogs]]></category>
		<category><![CDATA[R bloggers]]></category>
		<category><![CDATA[R blogs]]></category>
		<category><![CDATA[the future of R]]></category>
		<category><![CDATA[the R blogosphere]]></category>
		<category><![CDATA[useR]]></category>
		<category><![CDATA[useR 2011]]></category>
		<category><![CDATA[WordPress.com]]></category>

		<guid isPermaLink="false">http://www.r-statistics.com/?p=818</guid>
		<description><![CDATA[This is (roughly) the lightning talk I gave in useR2011. If you are a reader of R-bloggers.com then this talk is not likely to tell you anything new. However, if you have a friend, college or student who is a new useRs of R, this talk will offer him a decent introduction to what the R [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:right;"><div class="socialize-in-button socialize-in-button-right"><iframe src="http://www.facebook.com/plugins/like.php?href=http://www.r-statistics.com/2011/10/the-present-and-future-of-the-r-blogosphere-a-7-minute-lightning-talk-from-user2011/&amp;layout=box_count&amp;show_faces=false&amp;width=50&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px !important; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.r-statistics.com/2011/10/the-present-and-future-of-the-r-blogosphere-a-7-minute-lightning-talk-from-user2011/"></g:plusone></div></div><p>This is (roughly) the lightning talk I gave in <a href="http://www.warwick.ac.uk/statsdept/user-2011/">useR2011</a>.  If you are a reader of <a href="http://www.r-bloggers.com/">R-bloggers.com</a> then this talk is not likely to tell you anything new.  However, if you have a friend, college or student who is a new useRs of R, this talk will offer him a decent introduction to what the R blogosphere is all about.</p>
<p>The talk is a call for people of the R community to participate more in reading, writing and interacting with blogs.</p>
<p>I was encouraged to record this talk per the request of Chel Hee Lee, so it may be used in the recent <a href="http://www.openstatistics.net/?page_id=1035">useR conference in Korea (2011)</a></p>
<p>The talk (briefly) goes through:</p>
<ol>
<li>The widespread influence of the R blogosphere</li>
<li>What R bloggers write about</li>
<li>How to encourage a blogger you enjoy reading to keep writing</li>
<li>How to start your own R blog (just go to <a href="http://wordpress.com/">wordpress.com</a>)</li>
<li>Basic tips about writing a blog</li>
<li>One advice about marketing your R blog (<a href="http://www.r-bloggers.com/add-your-blog/">add it to R-bloggers.com</a>)</li>
<li>And two thoughts about the future of R blogging (more bloggers and readers, and more interactive online visualization)</li>
</ol>
<p><iframe width="480" height="360" src="http://www.youtube.com/embed/I4ZhxqbgWG4" frameborder="0" allowfullscreen></iframe></p>
<p>My apologies for any of the glitches in my English.  For more talks about R, you can visit <a href="http://www.r-bloggers.com/RUG/">the R user groups blog</a>.  I hope more speakers from useR 2011 will consider uploading their talks online.</p>
<p><a href="http://www.r-statistics.com/wp-content/uploads/2011/10/Slide1-korea.gif"><img src="http://www.r-statistics.com/wp-content/uploads/2011/10/Slide1-korea-300x225.gif" alt="" title="Slide1 - korea" width="300" height="225" class="alignnone size-medium wp-image-820" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.r-statistics.com/2011/10/the-present-and-future-of-the-r-blogosphere-a-7-minute-lightning-talk-from-user2011/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Calling R lovers and bloggers &#8211; to work together on &#8220;The R Programming wikibook&#8221;</title>
		<link>http://www.r-statistics.com/2011/06/calling-r-lovers-and-bloggers-to-work-together-on-the-r-programming-wikibook/</link>
		<comments>http://www.r-statistics.com/2011/06/calling-r-lovers-and-bloggers-to-work-together-on-the-r-programming-wikibook/#comments</comments>
		<pubDate>Mon, 20 Jun 2011 14:05:29 +0000</pubDate>
		<dc:creator>Tal Galili</dc:creator>
				<category><![CDATA[R]]></category>
		<category><![CDATA[R community]]></category>
		<category><![CDATA[R links]]></category>
		<category><![CDATA[cc]]></category>
		<category><![CDATA[CC licence]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[free open source]]></category>
		<category><![CDATA[licence]]></category>
		<category><![CDATA[r books]]></category>
		<category><![CDATA[R programming]]></category>
		<category><![CDATA[wikibook]]></category>
		<category><![CDATA[wikipedia]]></category>

		<guid isPermaLink="false">http://www.r-statistics.com/?p=772</guid>
		<description><![CDATA[This post is a call for both R community members and R-bloggers, to come and help make The R Programming wikibook be amazing. The R Programming wikibook is not just another one of the many free books about statistics/R, it is a community project which aims to create a cross-disciplinary practical guide to the R programming language.  Here is [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:right;"><div class="socialize-in-button socialize-in-button-right"><iframe src="http://www.facebook.com/plugins/like.php?href=http://www.r-statistics.com/2011/06/calling-r-lovers-and-bloggers-to-work-together-on-the-r-programming-wikibook/&amp;layout=box_count&amp;show_faces=false&amp;width=50&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px !important; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.r-statistics.com/2011/06/calling-r-lovers-and-bloggers-to-work-together-on-the-r-programming-wikibook/"></g:plusone></div></div><p style="text-align: center;"><a href="http://www.r-statistics.com/wp-content/uploads/2011/06/400px-Wikibooks-logo-en.svg_.png"><img class="alignnone size-full wp-image-776" title="400px-Wikibooks-logo-en.svg" src="http://www.r-statistics.com/wp-content/uploads/2011/06/400px-Wikibooks-logo-en.svg_.png" alt="" width="400" height="400" /></a></p>
<p>This post is a call for both R community members and R-bloggers, to come and help make <a href="http://en.wikibooks.org/wiki/R_Programming">The R Programming wikibook</a> be amazing.</p>
<p>The R Programming wikibook is not just another one of the many <a href="http://www.r-statistics.com/2009/10/free-statistics-e-books-for-download/">free books about statistics/R</a>, it is a community project which aims to create a cross-disciplinary practical guide to the R programming language.  Here is how you can join:</p>
<p><span id="more-772"></span></p>
<p><strong>Dear R community member</strong> &#8211; please consider giving a visit to <a href="http://en.wikibooks.org/wiki/R_Programming">The R Programming wikibook</a>.  If you wish to contribute your knowledge and editing skills to the project, then you could learn how to write in<a href="http://en.wikibooks.org/wiki/Using_Wikibooks/Wiki-Markup "> wiki-markup here</a>, and how to<a href="http://en.wikibooks.org/wiki/Using_Wikibooks/How_To_Edit_A_Wikibook "> edit a wikibook here</a> (you can even use <a href="http://en.wikibooks.org/wiki/Talk:R_Programming#Syntax_Highlighting">R syntax highlighting in the wikibook</a>).  You could take information into the site from the (soon to be) growing <a href="http://en.wikibooks.org/wiki/R_Programming/Sources">list of available R resources</a> for harvesting.</p>
<p><strong>Dear R blogger</strong>, you can help <a href="http://en.wikibooks.org/wiki/R_Programming">The R Programming wikibook</a> by doing the following:</p>
<ul>
<li>Write to your readers about the project and invite them to join.</li>
<li>Add your blog&#8217;s R content as <a href="http://en.wikibooks.org/wiki/R_Programming/Sources">an available resource</a>for other editors to use for the wikibook.  Here is how to do that:
<ul>
<li>First, make a clear indication on your blog that your content is licensed under <a href="http://en.wikipedia.org/wiki/Creative_Commons_licenses#Combinations">cc-by-sa copyrights</a> (*see what it means at the end of the post). You can do this by adding it to the footer of your blog, or by writing a post that clearly states that this is the case (what a great opportunity to write to your readers about the project&#8230;).</li>
<li>Next, go and add a link, to where all of your R content is located on your site, to the <a href="http://en.wikibooks.org/wiki/R_Programming/Sources">resource page</a> (also with a link to the license post, if you wrote one).  For example, since I write about other things besides R, I would give a link to my <a href="http://www.r-statistics.com/category/r/">R category page</a>, and will also give a link to this post.  If you do not know how to add it to the wiki, just e-mail me about it (tal.galili@gmail.com).</li>
</ul>
</li>
</ul>
<p style="padding-left: 30px;">If you are an R blogger, besides living up to the spirit of the R community, you will benefit from joining this project in that every time someone will use your content on the wikibook, they will add your post as a resource.  In the long run, this is likely to help visitors of the site get to know about you and strengthen your site&#8217;s SEO ranking.  Which reminds me, if you write about this, I always appreciate a link back to my blog <img src='http://www.r-statistics.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p style="padding-left: 30px;">* Having a <a href="http://en.wikipedia.org/wiki/Creative_Commons_licenses#Combinations">cc-by-sa copyrights</a> means that you will agree that anyone may copy, distribute, display, and make derivative works based on your content, only if they give the author (you) the credits in the manner specified by you. And also that the user may distribute derivative works only under a license identical to the license that governs the original work.</p>
<p>&#8212;&#8212;&#8212;-</p>
<p>Three more points:</p>
<p>1) This post is a result of being <a href="http://www.r-statistics.com/contact-me/">contacted </a>by Paul (a.k.a: PAC2), asking if I could help promote &#8220;<a href="http://en.wikibooks.org/wiki/R_Programming">The R Programming wikibook</a>&#8221; among <a href="http://www.r-bloggers.com/">R-bloggers</a> and their readers.   Paul has made <a href="http://en.wikibooks.org/wiki/Special:Contributions/PAC2">many contributions</a> to the book so far.  So thank you Paul for both reaching out and helping all of us with your work on this free open source project.</p>
<p>2) I should also mention that the <a href="http://rwiki.sciviews.org/doku.php">R wiki</a> exists and is open for contribution.  And naturally, every thing that will help the R wikibook will help the R wiki as well.</p>
<p>3) <strong>Copyright notice: I hereby release all of the writing material content that is categoriesed in the <a href="http://www.r-statistics.com/category/r/">R category page</a>, under the <a href="http://en.wikipedia.org/wiki/Creative_Commons_licenses#Combinations">cc-by-sa copyrights</a> (date: 20.06.2011), as long as the copied content comes with proper attribution which also  <span style="text-decoration: underline;">includes a link</span> to the source of the article .  <span style="text-decoration: underline;">Now it&#8217;s your turn!</span></strong></p>
<p>&#8212;&#8212;&#8212;-</p>
<p>List of R bloggers who have joined: (This list will get updated as this &#8220;group writing&#8221; project will progress)</p>
<ul>
<li><a href="http://www.r-statistics.com/">R-statistics blog</a> (that&#8217;s me&#8230;)</li>
<li><a href="http://gettinggeneticsdone.blogspot.com/2011/06/steal-this-blog.html">GETTING GENETICS DONE</a></li>
<li><a href="http://strugglingthroughproblems.blogspot.com/search/label/R">Struggling Through Problems</a></li>
<li><a href="http://www.backsidesmack.com/2011/06/no-steal-this-blog/">Back side smack</a></li>
<li><a href="http://al3xandr3.github.com/tags/r.html">al3xandr3</a></li>
<li><a href="http://cloudnumbers.com/the-r-programming-wikibook">Cloudnumbers.com</a></li>
<li><a href="http://rtutorialseries.blogspot.com/2011/07/r-programming-wikibook.html">The R Tutorial Series blog</a></li>
<li>&#8230;</li>
</ul>
<p>For the most updated list, go to the <strong><a href="http://en.wikibooks.org/wiki/R_Programming/Sources">resource page</a></strong> on the <a href="http://en.wikibooks.org/wiki/R_Programming">The R Programming wikibook</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.r-statistics.com/2011/06/calling-r-lovers-and-bloggers-to-work-together-on-the-r-programming-wikibook/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Engineering Data Analysis (with R and ggplot2) &#8211; a Google Tech Talk given by Hadley Wickham</title>
		<link>http://www.r-statistics.com/2011/06/engineering-data-analysis-with-r-and-ggplot2-a-google-tech-talk-given-by-hadley-wickham/</link>
		<comments>http://www.r-statistics.com/2011/06/engineering-data-analysis-with-r-and-ggplot2-a-google-tech-talk-given-by-hadley-wickham/#comments</comments>
		<pubDate>Fri, 17 Jun 2011 08:30:48 +0000</pubDate>
		<dc:creator>Tal Galili</dc:creator>
				<category><![CDATA[R]]></category>
		<category><![CDATA[R links]]></category>
		<category><![CDATA[visualization]]></category>
		<category><![CDATA[ggplot2]]></category>
		<category><![CDATA[ggplot2 book]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google tech talk]]></category>
		<category><![CDATA[Hadley Wickham]]></category>

		<guid isPermaLink="false">http://www.r-statistics.com/?p=760</guid>
		<description><![CDATA[It appears that just days ago, Google Tech Talk released a new, one hour long, video of a presentation (from June 6, 2011) made by one of R&#8217;s community more influential contributors, Hadley Wickham. This seems to be one of the better talks to send a programmer friend who is interested in getting into R. [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:right;"><div class="socialize-in-button socialize-in-button-right"><iframe src="http://www.facebook.com/plugins/like.php?href=http://www.r-statistics.com/2011/06/engineering-data-analysis-with-r-and-ggplot2-a-google-tech-talk-given-by-hadley-wickham/&amp;layout=box_count&amp;show_faces=false&amp;width=50&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px !important; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.r-statistics.com/2011/06/engineering-data-analysis-with-r-and-ggplot2-a-google-tech-talk-given-by-hadley-wickham/"></g:plusone></div></div><p><a href="http://www.r-statistics.com/wp-content/uploads/2011/06/YouTube-Engineering-Data-Analysis-with-R-and-ggplot2-Google-Chrome_2011-06-17_11-31-21.png"><img class="alignnone size-full wp-image-764" title="YouTube - Engineering Data Analysis (with R and ggplot2) - Google Chrome_2011-06-17_11-31-21" src="http://www.r-statistics.com/wp-content/uploads/2011/06/YouTube-Engineering-Data-Analysis-with-R-and-ggplot2-Google-Chrome_2011-06-17_11-31-21-e1308299835422.png" alt="" width="500" height="307" /></a></p>
<p>It appears that just days ago, Google Tech Talk released a new, one hour long, video of a presentation (from June 6, 2011) made by one of R&#8217;s community more influential contributors, <a href="http://had.co.nz/">Hadley Wickham</a>.</p>
<p>This seems to be one of the better talks to send a programmer friend who is interested in getting into <a href="http://www.r-project.org/">R</a>.</p>
<h3>Talk abstract</h3>
<p>Data analysis, the process of converting data into knowledge, insight and understanding, is a critical part of statistics, but there&#8217;s surprisingly little research on it. In this talk I&#8217;ll introduce some of my recent work, including a model of data analysis. I&#8217;m a passionate advocate of programming that data analysis should be carried out using a programming language, and I&#8217;ll justify this by discussing some of the requirement of good data analysis (reproducibility, automation and communication). With these in mind, I&#8217;ll introduce you to a powerful set of tools for better understanding data: the statistical programming language R, and the ggplot2 domain specific language (DSL) for visualisation.</p>
<h3>The video</h3>
<p><object width="500" height="306"><param name="movie" value="http://www.youtube.com/v/TaxJwC_MP9Q?version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/TaxJwC_MP9Q?version=3" type="application/x-shockwave-flash" width="500" height="306" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<h3>More resources</h3>
<ul>
<li><a href="http://had.co.nz/">Hadley&#8217;s homepage</a></li>
<li><a href="http://hadley.github.com/">More talks/presentations by Hadley</a></li>
<li><a href="http://had.co.nz/ggplot2/book/">The ggplot2 book (sample chapters)</a></li>
<li><a href="http://cran.r-project.org/web/packages/ggplot2/index.html">GGplot2 on CRAN</a></li>
<li>Hat (link) tip goes to my good, <a href="http://productivewise.com/">social media, internet and productivity researcher</a>, friend Eyal Sela &#8211; for informing me about this talk.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.r-statistics.com/2011/06/engineering-data-analysis-with-r-and-ggplot2-a-google-tech-talk-given-by-hadley-wickham/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to upgrade R on windows 7</title>
		<link>http://www.r-statistics.com/2011/04/how-to-upgrade-r-on-windows-7/</link>
		<comments>http://www.r-statistics.com/2011/04/how-to-upgrade-r-on-windows-7/#comments</comments>
		<pubDate>Fri, 15 Apr 2011 07:42:43 +0000</pubDate>
		<dc:creator>Tal Galili</dc:creator>
				<category><![CDATA[R]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[program files]]></category>
		<category><![CDATA[R 2.13.0]]></category>
		<category><![CDATA[R code]]></category>
		<category><![CDATA[R upgrade]]></category>
		<category><![CDATA[upgrade]]></category>
		<category><![CDATA[upgrading R]]></category>
		<category><![CDATA[windows 7]]></category>
		<category><![CDATA[windows vista]]></category>

		<guid isPermaLink="false">http://www.r-statistics.com/?p=686</guid>
		<description><![CDATA[Background &#8211; time to upgrade to R 2.13.0 The news of the new release of R 2.13.0 is out, and the R blogosphere is buzzing. Bloggers posting excitedly about the new R compiler package that brings with it the hope to speed up our R code with up to 4 times improvement. So it is time [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:right;"><div class="socialize-in-button socialize-in-button-right"><iframe src="http://www.facebook.com/plugins/like.php?href=http://www.r-statistics.com/2011/04/how-to-upgrade-r-on-windows-7/&amp;layout=box_count&amp;show_faces=false&amp;width=50&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px !important; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.r-statistics.com/2011/04/how-to-upgrade-r-on-windows-7/"></g:plusone></div></div><h3>Background &#8211; time to upgrade to R 2.13.0</h3>
<p>The news of the new release of <a href="http://cran.r-project.org/bin/windows/base/">R 2.13.0</a> is out, and the <a href="http://www.r-bloggers.com/">R blogosphere</a> is buzzing.  Bloggers <a href="http://blog.revolutionanalytics.com/2011/04/r-2130-released.html">posting excitedly </a>about the new R compiler package that brings with it the hope to <a href="http://dirk.eddelbuettel.com/blog/2011/04/12/#the_new_r_compiler_package">speed up our R code with up to 4 times improvement</a>.  So it is time to upgrade, and bloggers are here to help.  Some wrote how to upgrade R on <a href="http://nsaunders.wordpress.com/2011/04/15/r-2-12-to-2-13-package-upgrade/">Linux</a> and <a href="http://www.imachordata.com/?p=745">mac OSX</a> (based on <a href="http://onertipaday.blogspot.com/2011/04/r-2130-is-released.html">posts by Paolo</a>).  And it is now my turn, with suggestions on how to upgrade R on windows 7.</p>
<h3>Upgrading R on windows &#8211; the two strategies</h3>
<p>The classic description of how to upgrade R can be found in <a href="http://cran.r-project.org/bin/windows/base/rw-FAQ.html#What_0027s-the-best-way-to-upgrade_003f">the R project FAQ page</a> (and also the <a href="http://cran.r-project.org/bin/windows/base/rw-FAQ.html#How-do-I-install-R-for-Windows_003f">FAQ on how to install R on windows</a>)</p>
<p>There are basically two strategies for R upgrading on windows.  The first is to install a new R version and copy paste all the packages to the new R installation folder.  The second is to have a global R package folder, each time synced to the most current R installation (thus saving us the time of copying the package library each we upgrade R).</p>
<p>I described the second strategy in detail in a post I wrote a year ago titled: &#8220;<a href="http://www.r-statistics.com/2010/04/changing-your-r-upgrading-strategy-and-the-r-code-to-do-it-on-windows/">How to upgrade R on windows XP – another strategy</a>&#8221; which explains how to upgrade R using the simple two-liner code:</p>

<div class="wp_codebox"><table><tr id="p68652"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p686code52"><pre class="rsplus" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">source</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;http://www.r-statistics.com/wp-content/uploads/2010/04/upgrading-R-on-windows.r.txt&quot;</span><span style="color: #080;">&#41;</span>
New.<span style="">R</span>.<span style="">RunMe</span><span style="color: #080;">&#40;</span><span style="color: #080;">&#41;</span></pre></td></tr></table></div>

<p>p.s: If this is the <strong>first time </strong>you are upgrading R using this method, then first run the following two lines on your old R installation (<strong>before </strong>running the above code in the new R intallation):</p>

<div class="wp_codebox"><table><tr id="p68653"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p686code53"><pre class="rsplus" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">source</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;http://www.r-statistics.com/wp-content/uploads/2010/04/upgrading-R-on-windows.r.txt&quot;</span><span style="color: #080;">&#41;</span>
Old.<span style="">R</span>.<span style="">RunMe</span><span style="color: #080;">&#40;</span><span style="color: #080;">&#41;</span></pre></td></tr></table></div>

<p>The above code should be enough.  However, there are some common pitfalls you might encounter when upgrading R on windows 7, bellow I outline the ones I know about, and how they can be solved.</p>
<p><span id="more-686"></span></p>
<h3>upgrade R on windows 7 &#8211; the issues</h3>
<p>Ideally, we would simply run the code above and go on doing our statistics.</p>
<p>But for windows 7 users there are several common issues when upgrading to a new version of R (compared to when<a title="How to upgrade R on windows XP – another strategy (and the R code to do it)" href="http://www.r-statistics.com/2010/04/changing-your-r-upgrading-strategy-and-the-r-code-to-do-it-on-windows/"> upgrading R in windows XP</a>).</p>
<h4>Issue 1 &#8211; folder location when upgrading from 32 bit to a 64 bit R version</h4>
<p><strong>The first issue </strong>is that the folder in which R is installed might be different if you have installed the 32 bit version on win 7 and now started using the 64 bit version, in which case you will need to run the following commands (notice the use of the &#8220;global.library.folder&#8221; paramater), I here assume you&#8217;ve installed R on D:\R.</p>

<div class="wp_codebox"><table><tr id="p68654"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p686code54"><pre class="rsplus" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">source</span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;http://www.r-statistics.com/wp-content/uploads/2010/04/upgrading-R-on-windows.r.txt&quot;</span><span style="color: #080;">&#41;</span>
<span style="color: #228B22;"># in the old R</span>
Old.<span style="">R</span>.<span style="">RunMe</span><span style="color: #080;">&#40;</span>global.<span style="">library</span>.<span style="">folder</span> <span style="color: #080;">=</span> <span style="color: #ff0000;">&quot;D:<span style="color: #000099; font-weight: bold;">\\</span>R<span style="color: #000099; font-weight: bold;">\\</span>library&quot;</span><span style="color: #080;">&#41;</span>
<span style="color: #228B22;"># in the new R</span>
New.<span style="">R</span>.<span style="">RunMe</span><span style="color: #080;">&#40;</span>global.<span style="">library</span>.<span style="">folder</span> <span style="color: #080;">=</span> <span style="color: #ff0000;">&quot;D:<span style="color: #000099; font-weight: bold;">\\</span>R<span style="color: #000099; font-weight: bold;">\\</span>library&quot;</span><span style="color: #080;">&#41;</span></pre></td></tr></table></div>

<h4>Issue 2 &#8211; folder permissions</h4>
<p><strong>The second issue</strong> is problem with permissions.  The default permissions of a regular user on windows 7 won&#8217;t let you create folders and files under the &#8220;c:\program files&#8221; directory (and, if I am not mistaken, for some other directories as well).   The result of this problem is that running the upgrade code I provided above, will often result with an error similar to this one:</p>
<blockquote><p>[1] &#8220;The path to the Global library ( d:\\R\\library\\ ) Didn&#8217;t exist &#8211; and was now created.&#8221;<br />
Error in file(file, ifelse(append, &#8220;a&#8221;, &#8220;w&#8221;)) :<br />
cannot open the connection<br />
In addition: Warning messages:<br />
1: In dir.create(global.library.folder) : &#8216;\library&#8217; already exists<br />
2: In dir.create(global.library.folder) :<br />
cannot create dir &#8216;\library&#8217;, reason &#8216;No error&#8217;<br />
3: In file(file, ifelse(append, &#8220;a&#8221;, &#8220;w&#8221;)) :<br />
cannot open file &#8216;D:/R/R-213~1.0\etc\Renviron.site&#8217;: Permission denied</p></blockquote>
<p>There are three solutions to this, the best one (I believe) is number 2 (maybe also combined with number 3):</p>
<p><strong>Solution 1</strong>: (which is easier to do, but I like less these days) is to run R with administrator privileges by following these steps:(<a href="http://superuser.com/questions/162680/having-a-shortcut-run-with-administrator-permissions-win-7">My thanks goes to superuser</a>):</p>
<ul>
<li> Right click on the R shortcut</li>
<li> Click on Properties</li>
<li> Select the Compatibility tab</li>
<li> At the bottom click &#8220;Change settings for all users&#8221;</li>
<li>Again at the bottom select to &#8220;Run this program as an administrator&#8221;</li>
</ul>
<p>The downside of this method is that every time you will start up R, you will get a nagging pop-up window asking you if you want to grant admin privileges to R, not a fun thing to deal with on a day to day basis.  Also, some other programs might have a hard time &#8220;doing things to&#8221; R, if it is run as administrator while they are not.</p>
<p><strong>Solution 2 <strong>(editors pick)</strong></strong>:  Change (grant) your own user permissions to the relevant R folders (for example: &#8220;D:\R&#8221;). In order to do this you can simply follow the steps described <a href="http://www.blogsdna.com/2159/how-to-take-ownership-grant-permissions-to-access-files-folder-in-windows-7.htm">here</a>.</p>
<p><strong>Solution 3: </strong>Install R in something like &#8220;D:\R&#8221; instead of &#8220;C:\program files\R&#8221; so to avoid permission problems.</p>
<p>It is advisable to restart your Rgui in order to have the changes (for example, file permission changes) take effect.  Also, sometimes you need to install the same package twice before the installation &#8220;catches&#8221; (e.g: that you&#8217;d get the &#8220;package &#8216;***&#8217; successfully unpacked and MD5 sums checked&#8221; massage).</p>
<h4>Issue 3 &#8211; antivirus file access restrictions</h4>
<p>One of the possible error massage you might come across when trying to upgrade (or install) your R packages is the following:</p>
<blockquote><p>massage:<br />
package &#8216;***&#8217; successfully unpacked and MD5 sums checked<br />
Warning: unable to move temporary installation &#8216;C:\Program Files\R\R-2.13.0\library\file70669f\***&#8217; to &#8216;C:\Program Files\R\R-2.13.0\library\***&#8217;</p></blockquote>
<p>After (too much) pocking around, I <strong>suspect</strong> that the source of this error was two things.  The first is my antivirus software.  It appears that the &#8220;real time file system protection&#8221; was blocking R from copying the files between folders once they were downloaded.  The second is the permission issues discussed above.<br />
<strong>The solution</strong> is to add the R directory path to the exception list in the antivirus software + fixing the user permission as discussed above in &#8220;solution 2&#8243;.<br />
p.s: I suspect that the reason this error happens with only some of the packages and not all of them is because of the *.dll the error prune packages have in them.  But I am not sure of that.<br />
<strong>Update</strong>: After disabling the antivirus while updating, I still found that I need to use the update function twice until it is able to properly install the package.  Another potential reason for this problem was <a href="http://www.mail-archive.com/r-help@stat.math.ethz.ch/msg46356.html">posted in 2005</a> by Sean O&#8217;Riordain suggesting that:</p>
<blockquote><p>This is just an FYI documenting a conflict between R and<br />
Google-Desktop.  The solution was to click on the Google-Desktop icon<br />
in the systray and click on &#8220;Pause Indexing&#8221;.  I also temporarily<br />
suspended anti-virus scanning before successfully<br />
install.packages(&#8220;VR&#8221;) many times without getting an error message.</p>
<p>I was getting an intermittant failure when I tried to install a<br />
package or update a package under Win-XP-Pro-sp2.</p>
<p>There is 5gb of free space on the drive and I&#8217;m an admistrator on this<br />
machine and most times (but not every time) I tried to<br />
upgrade.packages() or install.packages() I got the following error<br />
message &#8220;unable to move temporary installation&#8221; message.</p>
<p>It appears to be a file-locking issue with the Google-Desktop search -<br />
ie. during the few seconds that install.packages() creates a fileNNNN<br />
directory tree, google-desktop starts reading these files and then<br />
prevents this tree from being moved to its correct place under<br />
\library</p>
<p>cheers,<br />
Sean</p></blockquote>
<p>&nbsp;</p>
<p>I wish R will have an &#8220;automatic update&#8221; mechanism one day, but until then I hope the above code will make your R upgrading experience a tiny bit easier&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.r-statistics.com/2011/04/how-to-upgrade-r-on-windows-7/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
	</channel>
</rss>

