<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>[R]appster</title>
	<atom:link href="http://rappster.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://rappster.wordpress.com</link>
	<description>coding out loud</description>
	<lastBuildDate>Wed, 07 Mar 2012 21:44:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='rappster.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>[R]appster</title>
		<link>http://rappster.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://rappster.wordpress.com/osd.xml" title="[R]appster" />
	<atom:link rel='hub' href='http://rappster.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Color Theme for Eclipse IDE + StatET Editor: rappster</title>
		<link>http://rappster.wordpress.com/2012/02/16/color-theme-for-eclipse-ide-statet-editor-rappster/</link>
		<comments>http://rappster.wordpress.com/2012/02/16/color-theme-for-eclipse-ide-statet-editor-rappster/#comments</comments>
		<pubDate>Thu, 16 Feb 2012 19:19:10 +0000</pubDate>
		<dc:creator>songpants</dc:creator>
				<category><![CDATA[R]]></category>
		<category><![CDATA[color theme]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[r]]></category>
		<category><![CDATA[StatET]]></category>
		<category><![CDATA[syntax highlighting]]></category>

		<guid isPermaLink="false">http://rappster.wordpress.com/?p=174</guid>
		<description><![CDATA[I&#8217;ve played around a bit with the Eclipse Color Themes plugin by Felix Dahlke and Roger Dudler as they added support for the R editor that ships with plugin StatET late last year. The outcome is a little color theme called rappster. The nice thing with those color themes is that you can make your syntax &#8230; <a href="http://rappster.wordpress.com/2012/02/16/color-theme-for-eclipse-ide-statet-editor-rappster/">Continue reading <span class="meta-nav">&#187;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rappster.wordpress.com&amp;blog=28361168&amp;post=174&amp;subd=rappster&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve played around a bit with the <strong><a title="Eclipse Color Themes" href="http://www.eclipsecolorthemes.org/" target="_blank">Eclipse Color Themes</a></strong> plugin by <a title="Felix Dahlke" href="http://ubercode.de/" target="_blank">Felix Dahlke</a> and <a title="Roger Dudler" href="http://www.rogerdudler.com/" target="_blank">Roger Dudler</a> as they added support for the R editor that ships with plugin <a title="StatET" href="http://www.walware.de/it/statet/" target="_blank">StatET</a> late last year.</p>
<p>The outcome is a little color theme called <a title="rappster" href="http://www.eclipsecolorthemes.org/?list=all&amp;q=rappster" target="_blank">rappster</a>. The nice thing with those color themes is that you can make your syntax highlighting settings portable as you can simply import the theme of your choice in another instance of Eclipse, e.g. when updating to a newer version.</p>
<p>Unfortunately, the StatET editor is not available for previews at <strong><a title="Eclipse Color Themes" href="http://www.eclipsecolorthemes.org/" target="_blank">Eclipse Color Themes</a></strong> website, so I&#8217;ve added a couple of screenshots of how the theme handles the syntax highlighting of R code:</p>
<p><strong>Screenshot 1</strong></p>
<p style="text-align:center;"><a href="http://rappster.files.wordpress.com/2012/02/rappster_ct_1.jpg"><img title="rappster_ct_1" src="http://rappster.files.wordpress.com/2012/02/rappster_ct_1.jpg?w=718&#038;h=833" alt="" width="718" height="833" /></a></p>
<p><strong>Screenshot 2</strong></p>
<p><a href="http://rappster.files.wordpress.com/2012/02/rappster_ct_2.jpg"><img title="rappster_ct_2" src="http://rappster.files.wordpress.com/2012/02/rappster_ct_2.jpg?w=718&#038;h=833" alt="" width="718" height="833" /></a></p>
<p><strong>Instructions for installation</strong></p>
<p>If you don&#8217;t have a recent Eclipse installation together with the StatET plugin yet, then</p>
<ol>
<li>go to <a title="Eclipse Downloads" href="http://www.eclipse.org/downloads/" target="_blank">http://www.eclipse.org/downloads/</a>, grab the desired version of the Classic Installer (Eclipse Classic 3.x.x)</li>
<li>Open up Eclipse, select a working directory.</li>
<li>Go to [Window &gt; Preferences &gt; Install New Software...], enter the StatET URL that is associated to your Eclipse version (check this at <a title="StatET" href="http://www.walware.de/it/statet/installation.mframe" target="_blank">http://www.walware.de/it/statet/installation.mframe</a>), click the [Add] button, assign a name (StatET) and click your way through the further installation process.</li>
<li>Next you need to set up at least one R run configuration. This is more or less self explanatory once you find [Run &gt; Run Configurations...] and double click on the category [R Console]. If you ran the configuration once, it shows up in the run configurations short cuts list (little black arrow next the the bigger green/white arrow button in Eclipse&#8217;s icon bar.</li>
<li>Create an R project in the Package Explorer/Project Explorer (depends on perspective): right click, then [New &gt; Other &gt; StatET &gt; R project]. Confirm the switch to the StatET perspective.</li>
<li>Create an R script file in your R project: [New &gt; R script file].</li>
</ol>
<p>################################<br />
###### Install Eclipse Marketplace  ####<br />
################################</p>
<ol>
<li>Go to [Help &gt; Install New Software...] and select the entry in the drop-down menu [Work with:] that corresponds to the identifier of the respective Eclipse version<br />
(e.g. Helios, Indigo etc.; for Indigo, this would be: Indigo &#8211; <a href="http://download.eclipse.org/releases/indigo">http://download.eclipse.org/releases/indigo</a>).</li>
<li>Find category [General Purpose Tools], expand it, find sub-category [Marketplace Client], check its check box, click on the [Next &gt;] button, click on it again in the next screen that appears, accept the terms of license agreement in the next screen that appears, then finally click on the [Finish] button.</li>
<li>Wait for the installation to complete and restart Eclipse by clicking on button [Restart Now].</li>
</ol>
<p>######################################<br />
##### Install Eclipse Plugin <em>Color Theme</em>  #####<br />
######################################</p>
<p>This plugin enables the use of predefined color themes for text editors. The website of the maintainers can be found at <a href="http://www.eclipsecolorthemes.org/">http://www.eclipsecolorthemes.org/</a></p>
<ol>
<li>Go to [Help &gt; Eclipse Marketplace] and enter Color Theme in the text box [Find:] and hit the [ENTER] key</li>
<li>Find entry [Eclipse Color Theme] and click on the [Install] button, then the [Next] button, accept the terms of the license agreement and click the [Finish] button</li>
<li>In case of a security warning, accept the further installation by clicking on the [OK] button.</li>
<li>Wait for the installation to complete and restart Eclipse by clicking on button [Restart Now].</li>
</ol>
<p>#################################<br />
##### Install Color Theme <em>rappster</em>  #####<br />
#################################</p>
<ol>
<li>Go to <a title="rappster" href="http://www.eclipsecolorthemes.org/?list=all&amp;q=rappster" target="_blank">http://www.eclipsecolorthemes.org/?list=all&amp;q=rappster</a> and download the XML file associated to the color theme.</li>
<li>In Eclipse, go to [Window &gt; Preferences &gt; General &gt; Appearance &gt; Color Theme] and click on button [Import a theme...]</li>
<li>Select the XML file you just downloaded (<em>theme-6130.xml</em>)</li>
<li>In the left pane ([Theme:]), select color theme <em>rappster</em> and click the [OK] button.</li>
<li>Open up an arbitrary R script to see the effects of setting the <em>rappster</em> color theme.</li>
</ol>
<p>Have fun!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rappster.wordpress.com/174/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rappster.wordpress.com/174/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rappster.wordpress.com/174/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rappster.wordpress.com/174/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rappster.wordpress.com/174/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rappster.wordpress.com/174/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rappster.wordpress.com/174/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rappster.wordpress.com/174/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rappster.wordpress.com/174/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rappster.wordpress.com/174/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rappster.wordpress.com/174/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rappster.wordpress.com/174/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rappster.wordpress.com/174/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rappster.wordpress.com/174/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rappster.wordpress.com&amp;blog=28361168&amp;post=174&amp;subd=rappster&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rappster.wordpress.com/2012/02/16/color-theme-for-eclipse-ide-statet-editor-rappster/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/64bdf3dbb235368077ba047ad91f7c70?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">songpants</media:title>
		</media:content>

		<media:content url="http://rappster.files.wordpress.com/2012/02/rappster_ct_1.jpg" medium="image">
			<media:title type="html">rappster_ct_1</media:title>
		</media:content>

		<media:content url="http://rappster.files.wordpress.com/2012/02/rappster_ct_2.jpg" medium="image">
			<media:title type="html">rappster_ct_2</media:title>
		</media:content>
	</item>
		<item>
		<title>Update your Windows PATH &#8211; revisited</title>
		<link>http://rappster.wordpress.com/2011/12/16/update-your-windows-path-revisited/</link>
		<comments>http://rappster.wordpress.com/2011/12/16/update-your-windows-path-revisited/#comments</comments>
		<pubDate>Fri, 16 Dec 2011 00:03:40 +0000</pubDate>
		<dc:creator>songpants</dc:creator>
				<category><![CDATA[GitHub]]></category>
		<category><![CDATA[Portable Apps]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[r]]></category>

		<guid isPermaLink="false">http://rappster.wordpress.com/?p=147</guid>
		<description><![CDATA[Yihui got me psyched a little about GitHub After my last post about running your R infrastructure from an USB drive, he commented on my function that would update the Windows PATH (which is at least important for R and Rtools). Now I found some time to polish it a little. Feel free to test &#8230; <a href="http://rappster.wordpress.com/2011/12/16/update-your-windows-path-revisited/">Continue reading <span class="meta-nav">&#187;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rappster.wordpress.com&amp;blog=28361168&amp;post=147&amp;subd=rappster&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="https://github.com/yihui" target="_blank">Yihui</a> got me psyched a little about GitHub <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>After my last <a href="http://rappster.wordpress.com/2011/12/09/running-your-r-and-latex-infrastructure-from-a-portable-usb-drive/" target="_blank">post </a>about running your R infrastructure from an USB drive, he <a href="https://github.com/Songpants/RappsterMisc/commit/041267a9bac2be4e65dd36d17c50dece689d5334" target="_blank">commented</a> on my function that would update the Windows PATH (which is at least important for R and Rtools).</p>
<p>Now I found some time to polish it a little. Feel free to test (there&#8217;s a little example script) and comment on it on <a href="https://github.com/Rappster/RappsterMisc/blob/master/R/pathWindowsUpdate.R" target="_blank">GitHub</a>!</p>
<p><strong>UPDATE 2012-03-07</strong></p>
<p>Some further tweaking:</p>
<ul>
<li>Generic function: <a id="26a8df37af8d5d8bfdbf5e2a170a231bba144ece" href="https://github.com/Rappster/RappsterMisc/blob/master/R/gnrcs/pathWindowsUpdate.R">pathWindowsUpdate.R</a></li>
<li>Method for class &#8220;list&#8221;: <a id="3da1d0c95bf4715b03d6a26513585ef43e6c85ba" href="https://github.com/Rappster/RappsterMisc/blob/master/R/mthds/list/pathWindowsUpdate.R">pathWindowsUpdate.R</a></li>
<li>Example: <a id="3995492e4cec5197aba090c704e9282a87a7eb91" href="https://github.com/Rappster/RappsterMisc/blob/master/inst/examples/pathWindowsUpdate.R">pathWindowsUpdate.R</a></li>
</ul>
<p>Note: you do need to other functions/methods in <a id="2c254ab7f68e16e35b1fa8c5b4ef1d15209aa0b2" href="https://github.com/Rappster/RappsterMisc/tree/master/R">R</a></p>
<p>Greetz</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rappster.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rappster.wordpress.com/147/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rappster.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rappster.wordpress.com/147/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rappster.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rappster.wordpress.com/147/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rappster.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rappster.wordpress.com/147/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rappster.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rappster.wordpress.com/147/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rappster.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rappster.wordpress.com/147/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rappster.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rappster.wordpress.com/147/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rappster.wordpress.com&amp;blog=28361168&amp;post=147&amp;subd=rappster&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rappster.wordpress.com/2011/12/16/update-your-windows-path-revisited/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/64bdf3dbb235368077ba047ad91f7c70?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">songpants</media:title>
		</media:content>
	</item>
		<item>
		<title>RMySQL: using the latest MySQL version</title>
		<link>http://rappster.wordpress.com/2011/12/15/rmysql-using-the-latest-mysql-version/</link>
		<comments>http://rappster.wordpress.com/2011/12/15/rmysql-using-the-latest-mysql-version/#comments</comments>
		<pubDate>Thu, 15 Dec 2011 16:34:33 +0000</pubDate>
		<dc:creator>songpants</dc:creator>
				<category><![CDATA[R]]></category>
		<category><![CDATA[Portable Apps]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[xampp]]></category>
		<category><![CDATA[r]]></category>

		<guid isPermaLink="false">http://rappster.wordpress.com/?p=106</guid>
		<description><![CDATA[In order to connect my R related stuff to a webserver and MySQL I went all the way from using xampp to setting up my own (W)AMPP  (Apache MySQL PHP Perl) to finally back to using xampp. And I&#8217;m quite happy about this very last switch to xampp! Why I like xampp it&#8217;s open-source and &#8230; <a href="http://rappster.wordpress.com/2011/12/15/rmysql-using-the-latest-mysql-version/">Continue reading <span class="meta-nav">&#187;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rappster.wordpress.com&amp;blog=28361168&amp;post=106&amp;subd=rappster&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:left;"><a href="http://rappster.files.wordpress.com/2011/12/xampp_logo.jpg"><img class="alignleft size-medium wp-image-138" title="xampp_logo" src="http://rappster.files.wordpress.com/2011/12/xampp_logo.jpg?w=300&#038;h=225" alt="" width="300" height="225" /></a></p>
<p style="text-align:left;">In order to connect my R related stuff to a webserver and MySQL I went all the way from using <strong><span style="text-decoration:underline;"><a title="xampp" href="http://www.apachefriends.org/de/xampp.html" target="_blank">xampp</a></span></strong> to setting up my own (W)AMPP  (<strong>A</strong>pache <strong>M</strong>ySQL <strong>P</strong>HP <strong>P</strong>erl) to finally back to using xampp. And I&#8217;m quite happy about this very last switch to xampp!</p>
<p><strong>Why I like xampp</strong></p>
<ul>
<li>it&#8217;s open-source and actively maintained (thanks to the guys over at <a href="http://www.apachefriends.org/en/index.html" target="_blank">ApacheFriends.org</a>!)</li>
<li>it can be run as a portable app from an USB device</li>
<li>it&#8217;s hassle free when you want to use an AMPP bundle but don&#8217;t like to spend your time configuring the whole thing</li>
</ul>
<p><strong>Why I parted from xampp</strong></p>
<p>The reason I parted from xampp in the first place was the fact that I thought that the latest <span style="text-decoration:underline;"><strong><a title="RMySQL" href="http://cran.at.r-project.org/web/packages/RMySQL/index.html" target="_blank">RMySQL</a></strong></span> version that is up on CRAN only seems to like MySQL version <span style="text-decoration:underline;"><strong><a title="MySQL" href="http://downloads.mysql.com/archives/mysql-5.0/mysql-5.0.67.zip" target="_blank">5.0.67</a></strong></span> (dating back to 2008-08-04). This forced my to use a way outdated version of xampp (<span style="text-decoration:underline;"><strong><a title="xampp" href="http://sourceforge.net/projects/xampp/files/XAMPP%20Windows/1.6.8/xampp-win32-1.6.8.exe/download" target="_blank">version 1.6.8</a></strong></span>).</p>
<p>So at some point I decided to set up my own (W)AMPP bundle. It&#8217;s not that hard, but you do need to spend some time aligning config files. For those interested, I&#8217;ve written a little <span style="text-decoration:underline;"><strong><a title="AMPP On Windows" href="https://github.com/Songpants/RappsterMisc/blob/master/AMPP_On_Windows.pdf" target="_blank">manual </a></strong></span>on how to do this on Windows. When you read it, please have in mind that I just scratched it down for my own purpose. It&#8217;s not really polished <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p><strong>Why I switched back to xampp</strong></p>
<p>Yesterday I found out that RMySQL indeed connects to any MySQL version if you&#8217;re fine with some initial copy and pasting of MySQL files. Unfortunately, this info is not readily available (neither on CRAN nor under the provided <span style="text-decoration:underline;"><strong><a title="RMySQL" href="http://biostat.mc.vanderbilt.edu/RMySQL" target="_blank">URL</a></strong></span>), at least not for Windows. I actually found it on <span style="text-decoration:underline;"><strong><a title="Stack Overflow" href="http://stackoverflow.com/questions/4785933/adding-rmysql-package-to-r-fails" target="_blank">Stack Overflow</a></strong></span> (thanks to <span style="text-decoration:underline;"><strong><a title="Yuri" href="http://stackoverflow.com/users/614735/yuriy-petrovskiy" target="_blank">Yuri</a></strong></span>) which is becoming one of my favorite resources for programming related information. I&#8217;ve adapted it a little to fit my needs.</p>
<p><strong>How to use RMySQL with an arbitrary version of MySQL</strong></p>
<p>Here&#8217;s the walk through for a fully portable installation. It assumes you have a directory called <em>Apps</em> directly below your USB drive (<em>&lt;DRIVE&gt;</em>)</p>
<ol>
<li>Get the latest portable <strong>xampp</strong> (<span style="text-decoration:underline;"><strong><a title="xampp portable" href="http://sourceforge.net/projects/xampp/files/XAMPP%20Windows/1.7.7/xampp-win32-1.7.7-usb-lite.7z/download" target="_blank">here</a></strong></span>) and put it on your USB drive (mine lives here: <em>&lt;DRIVE&gt;\Apps\xampp\1.7.7</em>)</li>
<li>Get the latest <strong>RTools</strong> (<span style="text-decoration:underline;"><strong><a href="http://www.murdoch-sutherland.com/Rtools/" rel="nofollow">here</a></strong></span>) and install it to your USB drive (mine lives like: <em>&lt;DRIVE&gt;\Apps\Rtools\2.14</em>). Be sure that the following paths are included in your Windows PATH variable:<br />
<em><em>&lt;DRIVE&gt;\Apps</em>\Rtools\2.14\bin</em><br />
<em><em>&lt;DRIVE&gt;\Apps</em>\Rtools\2.14\MinGW\bin</em><br />
<em><em>&lt;DRIVE&gt;\Apps</em>\Rtools\2.14\MinGW64\bin</em></li>
<li>Set <strong>MYSQL_HOME</strong><br />
There are some alternatives here:<br />
a) You create or edite file <em>&lt;DRIVE&gt;\Apps\R\R-2.14.0\etc\Renviron.site</em> and add a line: <em><br />
MYSQL_HOME=&lt;DRIVE&gt;\Apps\xampp\1.7.7\mysql</em><br />
b) In case you use Eclipse (which I still favor over RStudio exactly because of features like this) you can set an environment variable directly in your R Run Configuration:<a href="http://rappster.files.wordpress.com/2011/12/eclipse_runconfig.jpg"><br />
</a><br />
<a href="http://rappster.files.wordpress.com/2011/12/eclipse_runconfig.jpg"><img class=" wp-image-108 aligncenter" title="Eclipse_runconfig" src="http://rappster.files.wordpress.com/2011/12/eclipse_runconfig.jpg?w=413&#038;h=287" alt="" width="413" height="287" /></a><a href="http://rappster.files.wordpress.com/2011/12/eclipse1.jpg"><img class="aligncenter size-large wp-image-131" title="Eclipse" src="http://rappster.files.wordpress.com/2011/12/eclipse1.jpg?w=1024&#038;h=577" alt="" width="1024" height="577" /></a></li>
<li><strong>copy</strong> <em><br />
&lt;DRIVE&gt;\Apps\xampp\1.7.7\mysql\lib\libmysql.lib</em><br />
<strong>to</strong> <em><br />
&lt;DRIVE&gt;\Apps\xampp\1.7.7\mysql\lib\opt\</em><br />
to meet dependencies of RMySQL.</li>
<li><strong>copy</strong><br />
<em>&lt;DRIVE&gt;\Apps\xampp\1.7.7\mysql\lib\libmysql.dll</em><br />
<strong>to</strong><br />
<em>&lt;DRIVE&gt;\Apps\R\R-2.14.0\bin\</em> (64 bit)<br />
<strong>or to</strong><br />
<em></em><em>&lt;DRIVE&gt;\Apps\R\R-2.14.0\bin</em>\i386\ (32 bit)<br />
<strong>or to</strong><br />
<em>C:\Windows\System32</em>.</li>
<li>run<em> install.packages()<br />
</em><pre class="brush: r;">
install.packages(&quot;RMySQL&quot;,
    type=&quot;source&quot;,
    lib=&quot;&lt;DRIVE&gt;\Apps\R\R-2.14.0\library&quot;,
    destdir=&quot;&lt;DRIVE&gt;\Apps\R\R-2.14.0\destdir&quot;
)
</pre></p>
<p>If the last step finishes without any errors, then you&#8217;re good to go. Otherwise probably something just went wrong with file paths.</p>
<p>Greetz!</li>
</ol>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rappster.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rappster.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rappster.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rappster.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rappster.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rappster.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rappster.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rappster.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rappster.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rappster.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rappster.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rappster.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rappster.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rappster.wordpress.com/106/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rappster.wordpress.com&amp;blog=28361168&amp;post=106&amp;subd=rappster&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rappster.wordpress.com/2011/12/15/rmysql-using-the-latest-mysql-version/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/64bdf3dbb235368077ba047ad91f7c70?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">songpants</media:title>
		</media:content>

		<media:content url="http://rappster.files.wordpress.com/2011/12/xampp_logo.jpg?w=300" medium="image">
			<media:title type="html">xampp_logo</media:title>
		</media:content>

		<media:content url="http://rappster.files.wordpress.com/2011/12/eclipse_runconfig.jpg" medium="image">
			<media:title type="html">Eclipse_runconfig</media:title>
		</media:content>

		<media:content url="http://rappster.files.wordpress.com/2011/12/eclipse1.jpg?w=1024" medium="image">
			<media:title type="html">Eclipse</media:title>
		</media:content>
	</item>
		<item>
		<title>Running your R and LaTeX Infrastructure from a portable USB Drive</title>
		<link>http://rappster.wordpress.com/2011/12/09/running-your-r-and-latex-infrastructure-from-a-portable-usb-drive/</link>
		<comments>http://rappster.wordpress.com/2011/12/09/running-your-r-and-latex-infrastructure-from-a-portable-usb-drive/#comments</comments>
		<pubDate>Fri, 09 Dec 2011 13:17:06 +0000</pubDate>
		<dc:creator>songpants</dc:creator>
				<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[LyX]]></category>
		<category><![CDATA[Portable Apps]]></category>
		<category><![CDATA[R]]></category>

		<guid isPermaLink="false">http://rappster.wordpress.com/?p=77</guid>
		<description><![CDATA[On my road to eventually running all of my programs off an USB device I&#8217;ve gotten a little bit closer yesterday thanks to input from Duncan Murdoch and Yihui Xie. Eventually running the entire Windows OS off a USB drive would be nice (not talking about running it as a Virtual Machine, but to have &#8230; <a href="http://rappster.wordpress.com/2011/12/09/running-your-r-and-latex-infrastructure-from-a-portable-usb-drive/">Continue reading <span class="meta-nav">&#187;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rappster.wordpress.com&amp;blog=28361168&amp;post=77&amp;subd=rappster&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>On my road to eventually running all of my programs off an USB device I&#8217;ve gotten a little bit closer yesterday thanks to input from Duncan Murdoch and Yihui Xie.</p>
<p>Eventually running the entire Windows OS off a USB drive would be nice (not talking about running it as a Virtual Machine, but to have a bootable Windows on USB), so: any hints appreciated <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>My current R devel infrastructure consists of</p>
<ul>
<li><a title="R 2.14.0" href="http://cran.at.r-project.org/bin/windows/base/R-2.14.0-win.exe" target="_blank">R 2.14.0</a> (set up as portable)</li>
<li><a title="Eclipse 3.7" href="http://download.eclipse.org/eclipse/downloads/drops/R-3.7-201106131736/index.php" target="_blank">Eclipse 3.7</a> (set up as portable)</li>
<li><a title="StatET Plugin" href="http://www.walware.de/goto/statet" target="_blank">StatET Plugin</a> for Eclipse (integrates R into Eclipse)</li>
<li><a title="Rtools 2.14" href="http://www.murdoch-sutherland.com/Rtools/Rtools214.exe" target="_blank">Rtools 2.14</a> (set up as portable)</li>
<li><a title="MikTeX 2.9 Portable" href="http://miktex.org/portable/about" target="_blank">MikTeX 2.9 Portable</a> (true portable)</li>
<li><a title="LyX 2.0.2" href="ftp://ftp.lyx.org/pub/lyx/bin/2.0.2/LyX-2.0.2-1-Installer-Bundle.exe" target="_blank">LyX 2.0.2</a> (set up as portable; make sure you grab the <em>LyX-2.0.x.y-Installer-Bundle.exe</em> as it contains Ghostview and other important stuff)</li>
</ul>
<p><strong>Thanks to everyone providing and maintaing those tools!</strong></p>
<p>When I say &#8216;set up as portable&#8217;, that means I simply took the regular installer, but instead of installing to &#8220;C:\Program Files\&#8221;, I choose a directory on my USB device. This works (at least for me) surprisingly often. I guess the crucial part is if the respective application requires some MS Windows registry entry or not. If not, then you&#8217;re fine with running it in &#8220;portable mode&#8221;.</p>
<p>Kind of the most important aspect when running portable apps is that you need to turn absolute paths into relative paths for crucial system components.</p>
<p>Regarding <em>Eclipse</em>, <em>R</em>, <em>MikTeX </em>and <em>LyX</em>, this is not a problem in case you are fine with a few initial tweaks.</p>
<ul>
<ul>
<li>You need to change &#8216;&lt;LYXDIR&gt;/Ressource/lyxrc.dist&#8217; in order to account for MikTeX&#8217;s portable nature. Here&#8217;s my last line of that file:<br />
\path_prefix &#8220;$LyXDir\bin;$LyXDir\python;$LyXDir\imagemagick;$LyXDir\ghostscript;$LyXDir\..\..\MiKTeX\2.9\miktex\bin&#8221;</li>
<li>You need to/should write some wrapper functions that give you the <strong>relative</strong> paths to portable R&#8217;s library and destdir folder (which you probably want to be on your USB device as well; per default R installs packages to your harddrive, thus they are &#8220;lost&#8221; if you switch computers)</li>
</ul>
</ul>
<p>Yet, I&#8217;ve struggled with <em>Rtools</em> quite a while because I didn&#8217;t know how to alter the Windows System PATH based on some script, preferably an R script. Duncan Murdoch sent me some information about the MS Windows registry key that needs to be altered and AFAIU that&#8217;s how it&#8217;s done when you run the Rools Installer on Windows and opt that you&#8217;re fine with the installer altering your path. However, I didn&#8217;t feel up to the task of tweaking the registry. In case anyone is interested, this is what Duncan told me:</p>
<p>&#8220;We use the Inno Setup installer; it has a function for this.  Here&#8217;s the code used:</p>
<p>Root: HKLM; Subkey: SYSTEM\CurrentControlSet\Control\Session Manager\Environment; ValueType: expandsz; ValueName: PATH; ValueData: &#8220;{code:getNewPath}&#8221;; Tasks: setPath &#8220;</p>
<p>Now, yesterday while checking out the new <a title="knitr" href="http://yihui.github.com/knitr/" target="_blank"><strong>knitr</strong> </a>package from Yihui (very nice work by the way! And while where at it: props to Tal Galili for providing <a title="www.r-bloggers.com" href="http://www.r-bloggers.com" target="_blank">www.r-bloggers.com</a>; great source of info, go check it out!), I came across his little R script <a title="R script" href="https://github.com/yihui/lyx/blob/master/README.md" target="_blank">add-R-path-win.R</a> that does exactly what I was looking for. I adapted it a little to fit my needs. You can find it at my GitHub repo:</p>
<p><a title="GitHub" href="https://github.com/Songpants/RappsterMisc/blob/master/R/pathWindowsUpdate.R" target="_blank">https://github.com/Songpants/RappsterMisc/blob/master/R/pathWindowsUpdate.R</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rappster.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rappster.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rappster.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rappster.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rappster.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rappster.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rappster.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rappster.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rappster.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rappster.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rappster.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rappster.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rappster.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rappster.wordpress.com/77/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rappster.wordpress.com&amp;blog=28361168&amp;post=77&amp;subd=rappster&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rappster.wordpress.com/2011/12/09/running-your-r-and-latex-infrastructure-from-a-portable-usb-drive/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/64bdf3dbb235368077ba047ad91f7c70?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">songpants</media:title>
		</media:content>
	</item>
		<item>
		<title>Indexing Nested Lists</title>
		<link>http://rappster.wordpress.com/2011/11/20/indexing-nested-lists/</link>
		<comments>http://rappster.wordpress.com/2011/11/20/indexing-nested-lists/#comments</comments>
		<pubDate>Sun, 20 Nov 2011 22:14:21 +0000</pubDate>
		<dc:creator>songpants</dc:creator>
				<category><![CDATA[R]]></category>
		<category><![CDATA[indexing]]></category>
		<category><![CDATA[lists]]></category>
		<category><![CDATA[nested]]></category>
		<category><![CDATA[r]]></category>

		<guid isPermaLink="false">http://rappster.wordpress.com/?p=60</guid>
		<description><![CDATA[I&#8217;ve long searched for a somewhat efficient approach to indexing nested lists and/or environments and here&#8217;s my best solution so far. For me, being able to compute such an index is the crucial part in order to actually manage such nested structures (which are very helpful in a lot of scenarios where formal classes are &#8230; <a href="http://rappster.wordpress.com/2011/11/20/indexing-nested-lists/">Continue reading <span class="meta-nav">&#187;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rappster.wordpress.com&amp;blog=28361168&amp;post=60&amp;subd=rappster&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve long searched for a somewhat efficient approach to indexing nested lists and/or environments and here&#8217;s my best solution so far.</p>
<p>For me, being able to compute such an index is the crucial part in order to actually manage such nested structures (which are very helpful in a lot of scenarios where formal classes are too inflexible). What you need to master are a) being able to select a specific branch in the nested list and b) being able to update it (e.g. adding new branches). A use case would be parsing a config file format to a nested list structure.</p>
<p>Initially, I tried to get the job done by recursively traversing the branch structure, but that turned out to be really messy and inefficient.</p>
<p>Basically, the current approach is all about mimicing what &#8216;str()&#8217; does and putting this into a data frame structure:</p>
<p><pre class="brush: r;">
x str(x)
List of 1
$ a:List of 2
..$ a.1: int [1:3] 1 2 3
..$ a.2: logi TRUE
</pre></p>
<p>At this point, I&#8217;ll simply present you what the result of indexing such nested structure looks like. As I don&#8217;t have a Github repository set up yet, I&#8217;ll put the source code at the very end. Of course, there&#8217;s a lot of overhead since it&#8217;s based on a lot of regular expression stuff. If you have any suggestions for improvement, you&#8217;re more than welcome to tell me!</p>
<p><strong>I&#8217;m very sorry for the messed up indentation, but I&#8217;ve tried twice. WordPress keeps messing it up somehow. Suggestions on how to avoid this greatly appreciated.</strong></p>
<p><strong>Example list</strong></p>
<p><pre class="brush: r;">
setClass(&quot;TESTCLASS_X&quot;, representation=representation(a=&quot;numeric&quot;))
setRefClass(&quot;TESTCLASS_Y&quot;, fields=list(a=&quot;numeric&quot;))

src a=list(
a.1=list(a.1.1 = 1, a.1.2 = 1:5, a.1.3 = integer(0)),
a.2=list(a.2.1=&quot;a&quot;, a.2.2=c(&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;, &quot;e&quot;), a.2.3=character()),
a.3=list(a.3.1=1.5, a.3.2=c(1.5, 2.5), a.3.3=numeric()),
a.4=list(a.4.1=1+1i, a.4.2=c(0.1+0.3i, 0.2+0.2i, 0.1+0.1i), a.4.3=complex()),
a.5=list(a.5.1 = TRUE, a.5.2 = c(TRUE, TRUE, TRUE), a.5.3 = logical())
),
b=list(
b.1=list(
b.1.1=list(b.1.1.1 =matrix(1, ncol=1),
b.1.1.2=matrix(c(1:4), ncol=2, dimnames=list(NULL, c(&quot;a&quot;,&quot;b&quot;))),
b.1.1.3=matrix()
),
b.1.2=list(b.1.2.1=data.frame(1), b.1.2.2=data.frame(a=1:3, b=1:3),
b.1.2.3=data.frame()
)
),
b.2=list(
b.2.1=list(b.2.1.1=list(a=1), b.2.1.2=list(a=1:2, b=letters[1:2]),
b.2.1.3=list(a=1:2, b=&quot;a&quot;, c=1:3, d=FALSE, e=1:5), b.2.1.4=list()
)
)
),
c=list(
c.1=list(c.1.1=new.env(), c.1.2=new(&quot;TESTCLASS_X&quot;, a=1:5),
c.1.3=new(&quot;TESTCLASS_Y&quot;, a=1:5))
)
)
</pre></p>
<p><strong>After indexing</strong></p>
<p><pre class="brush: r;">
&gt; objectIndex(src=src)
name pos is.top is.bottom       class is.s4  dim
1                      a   1   TRUE     FALSE        list FALSE    5
2                  a/a.1   2  FALSE     FALSE        list FALSE    3
3            a/a.1/a.1.1   3  FALSE      TRUE     numeric FALSE    1
4            a/a.1/a.1.2   3  FALSE      TRUE     integer FALSE    5
5            a/a.1/a.1.3   3  FALSE      TRUE     integer FALSE    0
6                  a/a.2   2  FALSE     FALSE        list FALSE    3
7            a/a.2/a.2.1   3  FALSE      TRUE   character FALSE    1
8            a/a.2/a.2.2   3  FALSE      TRUE   character FALSE    5
9            a/a.2/a.2.3   3  FALSE      TRUE   character FALSE    0
10                 a/a.3   2  FALSE     FALSE        list FALSE    3
11           a/a.3/a.3.1   3  FALSE      TRUE     numeric FALSE    1
12           a/a.3/a.3.2   3  FALSE      TRUE     numeric FALSE    2
13           a/a.3/a.3.3   3  FALSE      TRUE     numeric FALSE    0
14                 a/a.4   2  FALSE     FALSE        list FALSE    3
15           a/a.4/a.4.1   3  FALSE      TRUE     complex FALSE    1
16           a/a.4/a.4.2   3  FALSE      TRUE     complex FALSE    3
17           a/a.4/a.4.3   3  FALSE      TRUE     complex FALSE    0
18                 a/a.5   2  FALSE     FALSE        list FALSE    3
19           a/a.5/a.5.1   3  FALSE      TRUE     logical FALSE    1
20           a/a.5/a.5.2   3  FALSE      TRUE     logical FALSE    3
21           a/a.5/a.5.3   3  FALSE      TRUE     logical FALSE    0
22                     b   1   TRUE     FALSE        list FALSE    2
23                 b/b.1   2  FALSE     FALSE        list FALSE    2
24           b/b.1/b.1.1   3  FALSE     FALSE        list FALSE    3
25   b/b.1/b.1.1/b.1.1.1   4  FALSE      TRUE      matrix FALSE  1-1
26   b/b.1/b.1.1/b.1.1.2   4  FALSE      TRUE      matrix FALSE  2-2
27   b/b.1/b.1.1/b.1.1.3   4  FALSE      TRUE      matrix FALSE  1-1
28           b/b.1/b.1.2   3  FALSE     FALSE        list FALSE    3
29   b/b.1/b.1.2/b.1.2.1   4  FALSE      TRUE  data.frame FALSE  1-1
30   b/b.1/b.1.2/b.1.2.2   4  FALSE      TRUE  data.frame FALSE  3-2
31   b/b.1/b.1.2/b.1.2.3   4  FALSE      TRUE  data.frame FALSE  0-0
32                 b/b.2   2  FALSE     FALSE        list FALSE    1
33           b/b.2/b.2.1   3  FALSE     FALSE        list FALSE    4
34   b/b.2/b.2.1/b.2.1.1   4  FALSE     FALSE        list FALSE    1
35 b/b.2/b.2.1/b.2.1.1/a   5  FALSE      TRUE     numeric FALSE    1
36   b/b.2/b.2.1/b.2.1.2   4  FALSE     FALSE        list FALSE    2
37 b/b.2/b.2.1/b.2.1.2/a   5  FALSE      TRUE     integer FALSE    2
38 b/b.2/b.2.1/b.2.1.2/b   5  FALSE      TRUE   character FALSE    2
39   b/b.2/b.2.1/b.2.1.3   4  FALSE     FALSE        list FALSE    5
40 b/b.2/b.2.1/b.2.1.3/a   5  FALSE      TRUE     integer FALSE    2
41 b/b.2/b.2.1/b.2.1.3/b   5  FALSE      TRUE   character FALSE    1
42 b/b.2/b.2.1/b.2.1.3/c   5  FALSE      TRUE     integer FALSE    3
43 b/b.2/b.2.1/b.2.1.3/d   5  FALSE      TRUE     logical FALSE    1
44 b/b.2/b.2.1/b.2.1.3/e   5  FALSE      TRUE     integer FALSE    5
45   b/b.2/b.2.1/b.2.1.4   4  FALSE     FALSE        list FALSE    0
46                     c   1   TRUE     FALSE        list FALSE    1
47                 c/c.1   2  FALSE     FALSE        list FALSE    3
48           c/c.1/c.1.1   3  FALSE      TRUE environment FALSE
49           c/c.1/c.1.2   3  FALSE      TRUE TESTCLASS_X  TRUE    1
50           c/c.1/c.1.3   3  FALSE      TRUE TESTCLASS_Y  TRUE    1

&gt; objectIndex(src=src, handle.preserve=&quot;all&quot;)
name pos is.top is.bottom       class is.s4  dim
1                    a   1   TRUE     FALSE        list FALSE    5
2                a/a.1   2  FALSE      TRUE        list FALSE    3
3                a/a.2   2  FALSE      TRUE        list FALSE    3
4                a/a.3   2  FALSE      TRUE        list FALSE    3
5                a/a.4   2  FALSE      TRUE        list FALSE    3
6                a/a.5   2  FALSE      TRUE        list FALSE    3
7                    b   1   TRUE     FALSE        list FALSE    2
8                b/b.1   2  FALSE     FALSE        list FALSE    2
9          b/b.1/b.1.1   3  FALSE     FALSE        list FALSE    3
10 b/b.1/b.1.1/b.1.1.1   4  FALSE      TRUE      matrix FALSE  1-1
11 b/b.1/b.1.1/b.1.1.2   4  FALSE      TRUE      matrix FALSE  2-2
12 b/b.1/b.1.1/b.1.1.3   4  FALSE      TRUE      matrix FALSE  1-1
13         b/b.1/b.1.2   3  FALSE     FALSE        list FALSE    3
14 b/b.1/b.1.2/b.1.2.1   4  FALSE      TRUE  data.frame FALSE  1-1
15 b/b.1/b.1.2/b.1.2.2   4  FALSE      TRUE  data.frame FALSE  3-2
16 b/b.1/b.1.2/b.1.2.3   4  FALSE      TRUE  data.frame FALSE  0-0
17               b/b.2   2  FALSE     FALSE        list FALSE    1
18         b/b.2/b.2.1   3  FALSE     FALSE        list FALSE    4
19 b/b.2/b.2.1/b.2.1.1   4  FALSE      TRUE        list FALSE    1
20 b/b.2/b.2.1/b.2.1.2   4  FALSE      TRUE        list FALSE    2
21 b/b.2/b.2.1/b.2.1.3   4  FALSE      TRUE        list FALSE    5
22 b/b.2/b.2.1/b.2.1.4   4  FALSE     FALSE        list FALSE    0
23                   c   1   TRUE     FALSE        list FALSE    1
24               c/c.1   2  FALSE     FALSE        list FALSE    3
25         c/c.1/c.1.1   3  FALSE      TRUE environment FALSE
26         c/c.1/c.1.2   3  FALSE     FALSE TESTCLASS_X  TRUE    1
27         c/c.1/c.1.3   3  FALSE     FALSE TESTCLASS_Y  TRUE    1

&gt; objectIndex(src=src, handle.preserve=&quot;data.frame&quot;)
name pos is.top is.bottom       class is.s4  dim
1                      a   1   TRUE     FALSE        list FALSE    5
2                  a/a.1   2  FALSE     FALSE        list FALSE    3
3            a/a.1/a.1.1   3  FALSE      TRUE     numeric FALSE    1
4            a/a.1/a.1.2   3  FALSE      TRUE     integer FALSE    5
5            a/a.1/a.1.3   3  FALSE      TRUE     integer FALSE    0
6                  a/a.2   2  FALSE     FALSE        list FALSE    3
7            a/a.2/a.2.1   3  FALSE      TRUE   character FALSE    1
8            a/a.2/a.2.2   3  FALSE      TRUE   character FALSE    5
9            a/a.2/a.2.3   3  FALSE      TRUE   character FALSE    0
10                 a/a.3   2  FALSE     FALSE        list FALSE    3
11           a/a.3/a.3.1   3  FALSE      TRUE     numeric FALSE    1
12           a/a.3/a.3.2   3  FALSE      TRUE     numeric FALSE    2
13           a/a.3/a.3.3   3  FALSE      TRUE     numeric FALSE    0
14                 a/a.4   2  FALSE     FALSE        list FALSE    3
15           a/a.4/a.4.1   3  FALSE      TRUE     complex FALSE    1
16           a/a.4/a.4.2   3  FALSE      TRUE     complex FALSE    3
17           a/a.4/a.4.3   3  FALSE      TRUE     complex FALSE    0
18                 a/a.5   2  FALSE     FALSE        list FALSE    3
19           a/a.5/a.5.1   3  FALSE      TRUE     logical FALSE    1
20           a/a.5/a.5.2   3  FALSE      TRUE     logical FALSE    3
21           a/a.5/a.5.3   3  FALSE      TRUE     logical FALSE    0
22                     b   1   TRUE     FALSE        list FALSE    2
23                 b/b.1   2  FALSE     FALSE        list FALSE    2
24           b/b.1/b.1.1   3  FALSE     FALSE        list FALSE    3
25   b/b.1/b.1.1/b.1.1.1   4  FALSE      TRUE      matrix FALSE  1-1
26   b/b.1/b.1.1/b.1.1.2   4  FALSE      TRUE      matrix FALSE  2-2
27   b/b.1/b.1.1/b.1.1.3   4  FALSE      TRUE      matrix FALSE  1-1
28           b/b.1/b.1.2   3  FALSE     FALSE        list FALSE    3
29   b/b.1/b.1.2/b.1.2.1   4  FALSE      TRUE  data.frame FALSE  1-1
30   b/b.1/b.1.2/b.1.2.2   4  FALSE      TRUE  data.frame FALSE  3-2
31   b/b.1/b.1.2/b.1.2.3   4  FALSE      TRUE  data.frame FALSE  0-0
32                 b/b.2   2  FALSE     FALSE        list FALSE    1
33           b/b.2/b.2.1   3  FALSE     FALSE        list FALSE    4
34   b/b.2/b.2.1/b.2.1.1   4  FALSE     FALSE        list FALSE    1
35 b/b.2/b.2.1/b.2.1.1/a   5  FALSE      TRUE     numeric FALSE    1
36   b/b.2/b.2.1/b.2.1.2   4  FALSE     FALSE        list FALSE    2
37 b/b.2/b.2.1/b.2.1.2/a   5  FALSE      TRUE     integer FALSE    2
38 b/b.2/b.2.1/b.2.1.2/b   5  FALSE      TRUE   character FALSE    2
39   b/b.2/b.2.1/b.2.1.3   4  FALSE     FALSE        list FALSE    5
40 b/b.2/b.2.1/b.2.1.3/a   5  FALSE      TRUE     integer FALSE    2
41 b/b.2/b.2.1/b.2.1.3/b   5  FALSE      TRUE   character FALSE    1
42 b/b.2/b.2.1/b.2.1.3/c   5  FALSE      TRUE     integer FALSE    3
43 b/b.2/b.2.1/b.2.1.3/d   5  FALSE      TRUE     logical FALSE    1
44 b/b.2/b.2.1/b.2.1.3/e   5  FALSE      TRUE     integer FALSE    5
45   b/b.2/b.2.1/b.2.1.4   4  FALSE     FALSE        list FALSE    0
46                     c   1   TRUE     FALSE        list FALSE    1
47                 c/c.1   2  FALSE     FALSE        list FALSE    3
48           c/c.1/c.1.1   3  FALSE      TRUE environment FALSE
49           c/c.1/c.1.2   3  FALSE     FALSE TESTCLASS_X  TRUE    1
50         c/c.1/c.1.2/a   5  FALSE      TRUE     integer FALSE    5
51           c/c.1/c.1.3   3  FALSE     FALSE TESTCLASS_Y  TRUE    1
52         c/c.1/c.1.3/a   4  FALSE      TRUE     integer FALSE    5

&gt; objectIndex(src=src, handle.preserve=&quot;s4&quot;)
name pos is.top is.bottom       class is.s4  dim
1                       a   1   TRUE     FALSE        list FALSE    5
2                   a/a.1   2  FALSE     FALSE        list FALSE    3
3             a/a.1/a.1.1   3  FALSE      TRUE     numeric FALSE    1
4             a/a.1/a.1.2   3  FALSE      TRUE     integer FALSE    5
5             a/a.1/a.1.3   3  FALSE      TRUE     integer FALSE    0
6                   a/a.2   2  FALSE     FALSE        list FALSE    3
7             a/a.2/a.2.1   3  FALSE      TRUE   character FALSE    1
8             a/a.2/a.2.2   3  FALSE      TRUE   character FALSE    5
9             a/a.2/a.2.3   3  FALSE      TRUE   character FALSE    0
10                  a/a.3   2  FALSE     FALSE        list FALSE    3
11            a/a.3/a.3.1   3  FALSE      TRUE     numeric FALSE    1
12            a/a.3/a.3.2   3  FALSE      TRUE     numeric FALSE    2
13            a/a.3/a.3.3   3  FALSE      TRUE     numeric FALSE    0
14                  a/a.4   2  FALSE     FALSE        list FALSE    3
15            a/a.4/a.4.1   3  FALSE      TRUE     complex FALSE    1
16            a/a.4/a.4.2   3  FALSE      TRUE     complex FALSE    3
17            a/a.4/a.4.3   3  FALSE      TRUE     complex FALSE    0
18                  a/a.5   2  FALSE     FALSE        list FALSE    3
19            a/a.5/a.5.1   3  FALSE      TRUE     logical FALSE    1
20            a/a.5/a.5.2   3  FALSE      TRUE     logical FALSE    3
21            a/a.5/a.5.3   3  FALSE      TRUE     logical FALSE    0
22                      b   1   TRUE     FALSE        list FALSE    2
23                  b/b.1   2  FALSE     FALSE        list FALSE    2
24            b/b.1/b.1.1   3  FALSE     FALSE        list FALSE    3
25    b/b.1/b.1.1/b.1.1.1   4  FALSE      TRUE      matrix FALSE  1-1
26    b/b.1/b.1.1/b.1.1.2   4  FALSE      TRUE      matrix FALSE  2-2
27    b/b.1/b.1.1/b.1.1.3   4  FALSE      TRUE      matrix FALSE  1-1
28            b/b.1/b.1.2   3  FALSE     FALSE        list FALSE    3
29    b/b.1/b.1.2/b.1.2.1   4  FALSE      TRUE  data.frame FALSE  1-1
30 b/b.1/b.1.2/b.1.2.1/X1   5  FALSE      TRUE     numeric FALSE    1
31    b/b.1/b.1.2/b.1.2.2   4  FALSE      TRUE  data.frame FALSE  3-2
32  b/b.1/b.1.2/b.1.2.2/a   5  FALSE      TRUE     integer FALSE    3
33  b/b.1/b.1.2/b.1.2.2/b   5  FALSE      TRUE     integer FALSE    3
34    b/b.1/b.1.2/b.1.2.3   4  FALSE      TRUE  data.frame FALSE  0-0
35                  b/b.2   2  FALSE     FALSE        list FALSE    1
36            b/b.2/b.2.1   3  FALSE     FALSE        list FALSE    4
37    b/b.2/b.2.1/b.2.1.1   4  FALSE     FALSE        list FALSE    1
38  b/b.2/b.2.1/b.2.1.1/a   5  FALSE      TRUE     numeric FALSE    1
39    b/b.2/b.2.1/b.2.1.2   4  FALSE     FALSE        list FALSE    2
40  b/b.2/b.2.1/b.2.1.2/a   5  FALSE      TRUE     integer FALSE    2
41  b/b.2/b.2.1/b.2.1.2/b   5  FALSE      TRUE   character FALSE    2
42    b/b.2/b.2.1/b.2.1.3   4  FALSE     FALSE        list FALSE    5
43  b/b.2/b.2.1/b.2.1.3/a   5  FALSE      TRUE     integer FALSE    2
44  b/b.2/b.2.1/b.2.1.3/b   5  FALSE      TRUE   character FALSE    1
45  b/b.2/b.2.1/b.2.1.3/c   5  FALSE      TRUE     integer FALSE    3
46  b/b.2/b.2.1/b.2.1.3/d   5  FALSE      TRUE     logical FALSE    1
47  b/b.2/b.2.1/b.2.1.3/e   5  FALSE      TRUE     integer FALSE    5
48    b/b.2/b.2.1/b.2.1.4   4  FALSE     FALSE        list FALSE    0
49                      c   1   TRUE     FALSE        list FALSE    1
50                  c/c.1   2  FALSE     FALSE        list FALSE    3
51            c/c.1/c.1.1   3  FALSE      TRUE environment FALSE
52            c/c.1/c.1.2   3  FALSE      TRUE TESTCLASS_X  TRUE    1
53            c/c.1/c.1.3   3  FALSE      TRUE TESTCLASS_Y  TRUE    1

&gt; objectIndex(src=src, handle.preserve=c(&quot;data.frame&quot;, &quot;s4&quot;))
name pos is.top is.bottom       class is.s4  dim
1                      a   1   TRUE     FALSE        list FALSE    5
2                  a/a.1   2  FALSE     FALSE        list FALSE    3
3            a/a.1/a.1.1   3  FALSE      TRUE     numeric FALSE    1
4            a/a.1/a.1.2   3  FALSE      TRUE     integer FALSE    5
5            a/a.1/a.1.3   3  FALSE      TRUE     integer FALSE    0
6                  a/a.2   2  FALSE     FALSE        list FALSE    3
7            a/a.2/a.2.1   3  FALSE      TRUE   character FALSE    1
8            a/a.2/a.2.2   3  FALSE      TRUE   character FALSE    5
9            a/a.2/a.2.3   3  FALSE      TRUE   character FALSE    0
10                 a/a.3   2  FALSE     FALSE        list FALSE    3
11           a/a.3/a.3.1   3  FALSE      TRUE     numeric FALSE    1
12           a/a.3/a.3.2   3  FALSE      TRUE     numeric FALSE    2
13           a/a.3/a.3.3   3  FALSE      TRUE     numeric FALSE    0
14                 a/a.4   2  FALSE     FALSE        list FALSE    3
15           a/a.4/a.4.1   3  FALSE      TRUE     complex FALSE    1
16           a/a.4/a.4.2   3  FALSE      TRUE     complex FALSE    3
17           a/a.4/a.4.3   3  FALSE      TRUE     complex FALSE    0
18                 a/a.5   2  FALSE     FALSE        list FALSE    3
19           a/a.5/a.5.1   3  FALSE      TRUE     logical FALSE    1
20           a/a.5/a.5.2   3  FALSE      TRUE     logical FALSE    3
21           a/a.5/a.5.3   3  FALSE      TRUE     logical FALSE    0
22                     b   1   TRUE     FALSE        list FALSE    2
23                 b/b.1   2  FALSE     FALSE        list FALSE    2
24           b/b.1/b.1.1   3  FALSE     FALSE        list FALSE    3
25   b/b.1/b.1.1/b.1.1.1   4  FALSE      TRUE      matrix FALSE  1-1
26   b/b.1/b.1.1/b.1.1.2   4  FALSE      TRUE      matrix FALSE  2-2
27   b/b.1/b.1.1/b.1.1.3   4  FALSE      TRUE      matrix FALSE  1-1
28           b/b.1/b.1.2   3  FALSE     FALSE        list FALSE    3
29   b/b.1/b.1.2/b.1.2.1   4  FALSE      TRUE  data.frame FALSE  1-1
30   b/b.1/b.1.2/b.1.2.2   4  FALSE      TRUE  data.frame FALSE  3-2
31   b/b.1/b.1.2/b.1.2.3   4  FALSE      TRUE  data.frame FALSE  0-0
32                 b/b.2   2  FALSE     FALSE        list FALSE    1
33           b/b.2/b.2.1   3  FALSE     FALSE        list FALSE    4
34   b/b.2/b.2.1/b.2.1.1   4  FALSE     FALSE        list FALSE    1
35 b/b.2/b.2.1/b.2.1.1/a   5  FALSE      TRUE     numeric FALSE    1
36   b/b.2/b.2.1/b.2.1.2   4  FALSE     FALSE        list FALSE    2
37 b/b.2/b.2.1/b.2.1.2/a   5  FALSE      TRUE     integer FALSE    2
38 b/b.2/b.2.1/b.2.1.2/b   5  FALSE      TRUE   character FALSE    2
39   b/b.2/b.2.1/b.2.1.3   4  FALSE     FALSE        list FALSE    5
40 b/b.2/b.2.1/b.2.1.3/a   5  FALSE      TRUE     integer FALSE    2
41 b/b.2/b.2.1/b.2.1.3/b   5  FALSE      TRUE   character FALSE    1
42 b/b.2/b.2.1/b.2.1.3/c   5  FALSE      TRUE     integer FALSE    3
43 b/b.2/b.2.1/b.2.1.3/d   5  FALSE      TRUE     logical FALSE    1
44 b/b.2/b.2.1/b.2.1.3/e   5  FALSE      TRUE     integer FALSE    5
45   b/b.2/b.2.1/b.2.1.4   4  FALSE     FALSE        list FALSE    0
46                     c   1   TRUE     FALSE        list FALSE    1
47                 c/c.1   2  FALSE     FALSE        list FALSE    3
48           c/c.1/c.1.1   3  FALSE      TRUE environment FALSE
49           c/c.1/c.1.2   3  FALSE      TRUE TESTCLASS_X  TRUE    1
50           c/c.1/c.1.3   3  FALSE      TRUE TESTCLASS_Y  TRUE    1
</pre></p>
<p><strong>Benchmarking</strong></p>
<p><pre class="brush: r;">

&gt; require(microbenchmark)
&gt; res &lt;- microbenchmark(objectIndex(src=src))
median(res$time/1000000000)
&gt; [1] 0.3378009

</pre></p>
<p>Here&#8217;s the code:</p>
<p><strong>Generics</strong></p>
<p><pre class="brush: r;">

setGeneric(
name=&quot;argProcess&quot;,
signature=c(&quot;arg&quot;),
def=function(
arg,
...
){
standardGeneric(&quot;argProcess&quot;)
}
)

setGeneric(
name=&quot;gregexpr2&quot;,
signature=c(&quot;src&quot;),
def=function(
src,
...
){
standardGeneric(&quot;gregexpr2&quot;)
}
)

setGeneric(
name=&quot;objectIndex&quot;,
signature=c(&quot;src&quot;),
def=function(
src,
...
){
standardGeneric(&quot;objectIndex&quot;)
}
)

</pre></p>
<p><strong>Methods</strong></p>
<p><pre class="brush: r;">

setMethod(
f=&quot;argProcess&quot;,
signature=signature(arg=&quot;character&quot;),
definition=function(
arg,
value.valid=NULL,
idx.restrict=NULL,
do.remove.null=FALSE,
...
){

#---------------------------------------------------------------------------
# ACTUAL PROCESSING
#---------------------------------------------------------------------------

if(!is.null(value.valid)){
subsetValidate(src=arg, tgt=value.valid,
.ARGS=.ARGS)
}

out &lt;- arg
#    if(length(arg) &gt; 1){
#        out &lt;- arg[1]
#    }
if(!is.null(idx.restrict)){
if(!is.numeric(idx.restrict)){
stop(paste(&quot;/invalid restriction index&quot;, sep=&quot;&quot;))
}
if(length(idx.restrict) &gt; length(out)){
stop(paste(&quot;/invalid restriction index length&quot;, sep=&quot;&quot;))
}
if(idx.restrict == 0){
if(length(out) &gt; 1){
msg &lt;- c(
paste(&quot;/invalid argument value&quot;, sep=&quot;&quot;), &quot;\n&quot;,
paste(&quot;* Value: '&quot;, paste(out, collapse=&quot;, &quot;), &quot;'&quot;, sep=&quot;&quot;), &quot;\n&quot;,
paste(&quot;* Needs to be singular&quot;, sep=&quot;&quot;)
)
stop(msg)
}
} else {
out &lt;- out[idx.restrict]
}
}

# REMOVE NULL
if(do.remove.null){
idx.null &lt;- which(is.null(out))
if(length(idx.null)){
out &lt;- out[-idx.null]
}
}
# /

# /ACTUAL PROCESSING ----------

#---------------------------------------------------------------------------
# FINALIZE
#---------------------------------------------------------------------------

return(out)

# /FINALIZE ----------

}
)

setMethod(
f=&quot;gregexpr2&quot;,
signature=signature(src=&quot;character&quot;),
definition=function(
src,
pattern,
do.ignore.case=FALSE,
do.perl=TRUE,
do.fixed=FALSE,
do.useBytes=FALSE,
do.simplify=FALSE,
...
){

#---------------------------------------------------------------------------
# ACTUAL PROCESSING
#---------------------------------------------------------------------------

if(all(is.na(src))){
out &lt;- lapply(1:length(src), function(x){
out &lt;- data.frame(start=NA, stop=NA)
})
} else {
idx.regex &lt;- gregexpr(
text=src,
pattern=pattern,
ignore.case=do.ignore.case,
perl=do.perl,
fixed=do.fixed,
useBytes=do.useBytes
)
out &lt;- lapply(idx.regex, function(x){
if(any(x == -1)){
out &lt;- data.frame(start=NA, stop=NA)
} else {
out &lt;- data.frame(start=x, stop=x+(attributes(x)$match.length-1))
}
return(out)
})
}

if(do.simplify){
if(length(out) == 1){
out &lt;- out[[1]]
}
}

# /ACTUAL PROCESSING ----------

#---------------------------------------------------------------------------
# FINALIZE
#---------------------------------------------------------------------------

return(out)

# /FINALIZE ----------

}
)

setMethod(
f=&quot;objectIndex&quot;,
signature=signature(src=&quot;list&quot;),
definition=function(
src,
handle.preserve=c(&quot;standard&quot;, &quot;all&quot;, &quot;no&quot;, &quot;data.frame&quot;, &quot;s4&quot;),
.delim.path=&quot;/&quot;,
...
){

#---------------------------------------------------------------------------
# GENERAL PREPROCESSING
#---------------------------------------------------------------------------

handle.preserve &lt;- argProcess(
arg=handle.preserve,
value.valid=c(&quot;standard&quot;, &quot;all&quot;, &quot;no&quot;, &quot;data.frame&quot;, &quot;s4&quot;)
)
if(&quot;standard&quot; %in% handle.preserve){
handle.preserve &lt;- &quot;standard&quot;
}

# /GENERAL PREPROCESSING ----------

#---------------------------------------------------------------------------
# PREPROCESSING
#---------------------------------------------------------------------------

# TRANSFORM IF FLAT
if(all(length(grep(.delim.path, names(src))&gt;0))){
# This is assuming that src is already an flattened list.
cat(paste(&quot;/preprocessing 'src' (deepening) ...&quot;, sep=&quot;&quot;), sep=&quot;\n&quot;)
src &lt;- objectDeepen(src=src, .ARGS=.ARGS)
}
# /

pattern &lt;- &quot;(\\.\\.)&quot;

# RETRIEVE STRUCTURE
temp &lt;- capture.output(str(src))
temp &lt;- temp[-1]
# /

# DROP ATTRIBUTES
idx &lt;- grep(&quot;\\.- attr\\(&quot;, temp)
idx.drop &lt;- unlist(lapply(idx, function(x.idx){
temp.attr &lt;- temp[x.idx]
idx.1 &lt;- gregexpr2(
src=temp.attr,
pattern=&quot;(\\[.*\\])|([[:digit:]]+\\s*obs|of|with).*[[:digit:]]+&quot;,
do.simplify=TRUE
)
out &lt;- NULL
if(all(!is.na(unlist(idx.1)))){
out &lt;- as.numeric(
gsub(&quot;[[:alpha:]]|[[:punct:]]|\\s&quot;, &quot;&quot;, substr(temp.attr, start=idx.1$start, stop=idx.1$stop))
)
out &lt;- x.idx:(x.idx+out)
}
}))
if(length(idx.drop)){
temp &lt;- temp[-idx.drop]
}
#temp
# /

# DROP METHODS
idx.drop &lt;- grep(&quot;\\..*[[:digit:]]+\\s*methods&quot;, temp)
if(length(idx.drop)){
temp &lt;- temp[-idx.drop]
}
#temp
# /

# /PREPROCESSING ----------

#---------------------------------------------------------------------------
# CLASS + DIMENSION
#---------------------------------------------------------------------------

# GET INDEX
idx &lt;- gregexpr2(
src=temp,
pattern=&quot;:.*$&quot;
)
# /

# CLASS AND DIM INFO
class.info &lt;- lapply(seq(along=idx), function(x.idx){
out.0 &lt;- substr(temp[x.idx], start=idx[[x.idx]]$start, stop=idx[[x.idx]]$stop)
if(is.na(out.0)){
return(NULL)
}
# DIMENSION / LENGTH
out.dim &lt;- 1
# Check for zero length
idx.1 &lt;- gregexpr2(
src=out.0,
pattern=&quot;^:\\s*\\w+\\(.*\\)&quot;,
do.simplify=TRUE
)
if(!all(is.na(unlist(idx.1)))){
out.dim &lt;- 0
idx.1   &lt;- NA
} else {
# Check for non-zero length
idx.1 &lt;- gregexpr2(
src=out.0,
#                    pattern=&quot;\\[[.*\\]]&quot;,
pattern=&quot;(\\[\\d+,?.*\\])|(:\t[[:digit:]]|(of|with).*[[:digit:]]+)&quot;,
do.simplify=TRUE
)
}
#print(idx.1)
#        out.dim &lt;- NA
if(all(!is.na(unlist(idx.1)))){
#x.idx=1
out.dim &lt;- lapply(1:nrow(idx.1), function(x.idx){
out.dim &lt;- substr(out.0, start=idx.1$start[x.idx],
stop=idx.1$stop[x.idx])
out.dim &lt;- unlist(strsplit(out.dim, split=&quot;, &quot;))
out.dim &lt;- lapply(out.dim, function(x.dim){
out.dim &lt;- x.dim
idx.1 &lt;- gregexpr2(
src=out.dim,
pattern=&quot;[[:digit:]]+&quot;,
do.simplify=TRUE
)
out.dim &lt;- sapply(1:nrow(idx.1), function(x.row){
substr(out.dim, start=idx.1$start[x.row], stop=idx.1$stop[x.row])
})
})
if(length(out.dim) == 1){
out.dim &lt;- out.dim[[1]]
}
out.dim
})
}
#print(out.dim)
# /
# CLASS
idx.s4 &lt;- FALSE

idx.1 &lt;- gregexpr2(
src=out.0,
pattern=&quot;^:\\s*&lt;?\\w+:?|('.*')&quot;,
do.simplify=TRUE
)
out.class &lt;- NA
if(all(!is.na(idx.1$start))){
out.class &lt;- sapply(1:nrow(idx.1), function(x.row){
out &lt;- substr(out.0, start=idx.1$start[x.row], stop=idx.1$stop[x.row])
out &lt;- gsub(&quot;^[[:punct:]]*|[[:punct:]]*$|\\s*&quot;, &quot;&quot;, out)
})
}
if(class(out.dim[[1]]) == &quot;list&quot; &amp; any(out.class != &quot;data.frame&quot;)){
out.class &lt;- &quot;matrix&quot;
} else {
out.dim &lt;- unlist(out.dim)
}

out.class &lt;- switch(
out.class[1],
&quot;chr&quot;=&quot;character&quot;,
&quot;cplx&quot;=&quot;complex&quot;,
&quot;data.frame&quot;={
out.dim &lt;- paste(out.dim, collapse=&quot;-&quot;)
&quot;data.frame&quot;
},
&quot;environment&quot;={
out.dim &lt;- NA
&quot;environment&quot;
},
&quot;Formal&quot;={
idx.s4 &lt;- TRUE
out.class[2]
},
&quot;int&quot;=&quot;integer&quot;,
&quot;list&quot;=&quot;list&quot;,
&quot;List&quot;=&quot;list&quot;,
&quot;logi&quot;=&quot;logical&quot;,
&quot;matrix&quot;={
out.dim &lt;- sapply(out.dim[[1]], function(x){
out.dim &lt;- x
if(length(out.dim) &gt; 1){
out.dim &lt;- out.dim[2]
}
out.dim
})
out.dim &lt;- paste(out.dim, collapse=&quot;-&quot;)
&quot;matrix&quot;
},
&quot;num&quot;=&quot;numeric&quot;,
&quot;Reference&quot;={
idx.s4 &lt;- TRUE
out.class[2]
}
)
# /
if(length(out.dim) &gt; 1){
out.dim &lt;- out.dim[2]
}
out &lt;- data.frame(class=out.class, is.s4=idx.s4,
dim=out.dim, stringsAsFactors=FALSE)
return(out)
})
class.info &lt;- do.call(&quot;rbind&quot;, class.info)
# /

idx.na &lt;- which(is.na(class.info$class))
if(length(idx.na)){
class.info &lt;- class.info[-idx.na,]
}

# /CLASS + DIMENSION ----------

#---------------------------------------------------------------------------
# MAIN PROCESSING
#---------------------------------------------------------------------------

temp &lt;- gsub(&quot;:.*$&quot;, &quot;&quot;, temp)
temp &lt;- gsub(&quot;\\s*\\$\\s*&quot;, &quot;&quot;, temp)
temp &lt;- gsub(&quot;^\\s*&quot;, &quot;&quot;, temp)
temp &lt;- gsub(&quot;@&quot;, &quot;&quot;, temp)
struc.names &lt;- gsub(&quot;\\s*$&quot;, &quot;&quot;, temp)
#struc.names
# /

# TRANSFORM STRUCTURE
idx.regex &lt;- gregexpr2(
src=struc.names,
pattern=pattern
)
struc.names &lt;- gsub(paste(pattern, &quot;|\\s*&quot;, sep=&quot;&quot;), &quot;&quot;, struc.names)
struc.pos   &lt;- sapply(idx.regex, function(x){
out &lt;- 0
if(all(!is.na(x$start))){
out &lt;- nrow(x)
}
return(out)
})

# STOP ON EMPTY NAMES
idx.empty &lt;- which(struc.names == &quot;&quot;)
if(length(idx.empty)){
msg &lt;- c(
paste(&quot;/names error:&quot;, sep=&quot;&quot;), &quot;\n&quot;,
paste(&quot;* Names: {&quot;, paste(struc.names, collapse=&quot;, &quot;), &quot;}&quot;, sep=&quot;&quot;)
)
stop(msg)
}
# /

# STRUCTURE
pos         &lt;- -1
path.0      &lt;- NULL
path.1      &lt;- NULL
is.top      &lt;- NULL
idx.zero &lt;- which(struc.pos == 0)
for(x in 1:length(struc.pos)){
res         &lt;- struc.pos[x]
pos.new     &lt;- list(res)
path.0.new  &lt;- struc.names[x]
if(struc.pos[x] &gt; pos){
pos &lt;- struc.pos[x]
} else {
# RESET
if(struc.pos[x] &lt; pos){
pos &lt;- struc.pos[x]
}
if(pos == 0){
path.0 &lt;- NULL
} else {
path.0 &lt;- path.0[1:pos]
}
# /
pos.new &lt;- list(0:res)

}
path.0  &lt;- c(path.0, path.0.new)

path.1.new  &lt;- paste(path.0, collapse=.delim.path)
path.1  &lt;- c(path.1, path.1.new)

is.top.new  &lt;- length(path.0) == 1
is.top      &lt;- c(is.top, is.top.new)
}

# STRUCTURE DF
struc.df &lt;- data.frame(
name=path.1,
pos=struc.pos+1,
is.top=is.top,
is.bottom=FALSE,
class.info,
stringsAsFactors=FALSE
)
# /

# BOTTOM BRANCHES
classes.pres &lt;- &quot;list&quot;
idx.bottom &lt;- which(!(struc.df$class %in% classes.pres) &amp; !struc.df$is.s4)
if(length(idx.bottom)){
struc.df$is.bottom[idx.bottom] &lt;- TRUE
}
# /

# HANDLE PRESERVE
if(!(&quot;no&quot; %in% handle.preserve)){
if(any(c(&quot;standard&quot;, &quot;data.frame&quot;) %in% handle.preserve)){
idx.pres &lt;- which(struc.df$class == &quot;data.frame&quot;)
if(length(idx.pres)){
struc.df$is.bottom[idx.pres] &lt;- TRUE
obj.dim &lt;- sapply(strsplit(struc.df$dim[idx.pres], split=&quot;-&quot;), function(x){
as.numeric(x[2])
})
idx.drop    &lt;- which(obj.dim == 0)
if(length(idx.drop)){
obj.dim     &lt;- obj.dim[-idx.drop]
idx.pres    &lt;- idx.pres[-idx.drop]
}
idx.temp    &lt;- data.frame(start=idx.pres+1, stop=idx.pres+obj.dim)
idx.drop    &lt;- unlist(lapply(1:nrow(idx.temp), function(x.row){
idx.temp$start[x.row]:idx.temp$stop[x.row]
}))
if(length(idx.drop)){
struc.df &lt;- struc.df[-idx.drop,]
rownames(struc.df) &lt;- NULL
}
}
}
if(any(c(&quot;standard&quot;, &quot;s4&quot;) %in% handle.preserve)){
idx.pres &lt;- which(struc.df$is.s4)
if(length(idx.pres)){
struc.df$is.bottom[idx.pres] &lt;- TRUE
obj.dim     &lt;- as.numeric(struc.df$dim[idx.pres])
idx.temp    &lt;- data.frame(start=idx.pres+1, stop=idx.pres+obj.dim)
idx.drop    &lt;- unlist(lapply(1:nrow(idx.temp), function(x.row){
idx.temp$start[x.row]:idx.temp$stop[x.row]
}))
idx.keep    &lt;- which(idx.drop %in% idx.pres)
if(length(idx.keep)){
idx.drop &lt;- idx.drop[-idx.keep]
}
if(length(idx.drop)){
struc.df &lt;- struc.df[-idx.drop,]
rownames(struc.df) &lt;- NULL
}
}
}
if(any(&quot;all&quot; %in% handle.preserve)){
idx.pres &lt;- which(struc.df$class == &quot;list&quot;)
if(length(idx.pres)){
classes.pres &lt;- c(&quot;data.frame&quot;, &quot;environment&quot;, &quot;list&quot;, &quot;matrix&quot;)
idx.drop &lt;- which(
struc.df$is.bottom &amp;
!(struc.df$class %in% classes.pres) &amp;
!(struc.df$is.s4)
)
idx.change &lt;- idx.pres + 1
idx &lt;- which(idx.change %in% idx.drop)
if(length(idx)){
idx.change &lt;- idx.change[idx] - 1
}
struc.df$is.bottom[idx.change] &lt;- TRUE
if(length(idx.drop)){
struc.df &lt;- struc.df[-idx.drop,]
rownames(struc.df) &lt;- NULL
}
}
}
}
# /

out &lt;- struc.df

# /MAIN PROCESSING ----------

#---------------------------------------------------------------------------
# FINALIZE
#---------------------------------------------------------------------------

return(out)

# /FINALIZE ----------

}
)

subsetValidate &lt;- function(
src,
tgt,
do.index=FALSE,
index.type=c(&quot;logical&quot;, &quot;numeric&quot;, &quot;logical.all&quot;, &quot;logical.any&quot;),
do.strict=TRUE,
do.warning=TRUE,
do.allow.nomatch=FALSE,
value.nomatch=NULL,
...
){
#---------------------------------------------------------------------------
# GENERAL PREPROCESSING
#---------------------------------------------------------------------------

if(missing(src) | missing(tgt)){
stop(&quot;/missing arguments 'src' and/or 'tgt'&quot;, sep=&quot;&quot;)
}
# VALIDATING AND PROCESSING SOURCE AND TARGET
do.special.src &lt;- FALSE
if(!is.character(src)){
if(.do.verbose | .do.debug){
cat(paste(&quot;/non-character 'src'. Processing ...&quot;,
sep=&quot;&quot;), sep=&quot;\n&quot;)
}
if(!is.na(src)){
if(is.null(names(src))){
stop(paste(&quot;/'src' has no names. Processing failed.&quot;,
sep=&quot;&quot;), sep=&quot;\n&quot;)
}
}
do.special.src &lt;- TRUE
src.0   &lt;- src
src     &lt;- names(src)
}
do.special.tgt &lt;- FALSE
if(!is.character(tgt)){
if(.do.verbose | .do.debug){
cat(paste(&quot;/non-character 'tgt'. Processing ...&quot;,
sep=&quot;&quot;), sep=&quot;\n&quot;)
}
if(!is.na(tgt)){
if(is.null(names(tgt))){
stop(paste(&quot;/'tgt' has no names. Processing failed.&quot;,
sep=&quot;&quot;), sep=&quot;\n&quot;)
}
}
do.special.tgt &lt;- TRUE
tgt.0   &lt;- tgt
tgt     &lt;- names(tgt)
}
# /
#    if(!is.character(src) | !is.character(tgt)){
#        stop(paste(
#            &quot;/expecting args 'src' and 'tgt' to be of class 'character'&quot;,
#            sep=&quot;&quot;))
#    }
index.type.valid &lt;- c(&quot;logical&quot;, &quot;numeric&quot;, &quot;logical.all&quot;, &quot;logical.any&quot;)
if(!all(index.type %in% index.type.valid)){
msg &lt;- c(
paste(&quot;/arg 'index.type' is invalid:&quot;, sep=&quot;&quot;),
&quot;\n&quot;,
paste(&quot;* Value: &quot;, paste(deparse(index.type), collapse=&quot;&quot;), sep=&quot;&quot;),
&quot;\n&quot;,
paste(&quot;* Valid: &quot;, paste(deparse(index.type.valid), collapse=&quot;&quot;), sep=&quot;&quot;)
)
stop(msg)
}
if(do.index &amp; length(index.type) &gt; 1){
index.type &lt;- index.type[1]
}

# /GENERAL PREPROCESSING ----------

#---------------------------------------------------------------------------
# ACTUAL PROCESSING
#---------------------------------------------------------------------------

idx.0 &lt;- src %in% tgt
idx.1 &lt;- which(idx.0)

if(do.index){
if(.do.verbose | .do.debug){
cat(paste(&quot;/swiching arg 'do.strict = FALSE&quot;, sep=&quot;&quot;), sep=&quot;\n&quot;)
cat(paste(&quot;/swiching arg 'do.warning = FALSE&quot;, sep=&quot;&quot;), sep=&quot;\n&quot;)
}
do.strict   &lt;- FALSE
do.warning  &lt;- FALSE
if(index.type == &quot;logical&quot;){
out.idx &lt;- idx.0
names(out.idx) &lt;- src
}
if(index.type == &quot;numeric&quot;){
out.idx &lt;- idx.1
names(out.idx) &lt;- src[out.idx]
}
if(index.type == &quot;logical.all&quot;){
out.idx &lt;- all(idx.0)
}
if(index.type == &quot;logical.any&quot;){
out.idx &lt;- any(idx.0)
}
}

# NO MATCH
if(!length(idx.1)){
if(!do.index){
if(do.allow.nomatch){
# LOCAL TERMINATE

return(value.nomatch)
} else {
msg &lt;- c(
paste(&quot;/non-matching elements in 'src' (all):&quot;, sep=&quot;&quot;),
&quot;\n&quot;,
paste(&quot;* '&quot;, src, &quot;'&quot;, sep=&quot;&quot;)
)
stop(msg)
}
} else {
if(index.type == &quot;numeric&quot;){
out.idx &lt;- numeric(0)
}
return(any(idx.0))
}
}
# /
# PARTLY MATCH
if(!all(idx.0)){
msg &lt;- c(
paste(&quot;/partly non-matching elements in 'src':&quot;, sep=&quot;&quot;),
&quot;\n&quot;,
paste(&quot;* '&quot;, src[which(!idx.0)], &quot;'&quot;, sep=&quot;&quot;)
)
if(do.strict){
if(do.allow.nomatch){
# LOCAL TERMINATE

return(value.nomatch)
} else {
stop(msg)
}
} else {
if(do.warning){
warning(msg)
}
}
}
# /
if(!do.index){
if(do.special.src){
if(is.data.frame(src.0) | is.matrix(src.0)){
tgt &lt;- src.0[,idx.1]
} else {
tgt &lt;- src.0[idx.1]
}
} else {
tgt &lt;- src[idx.1]
}
out &lt;- tgt
} else {
out &lt;- out.idx
}
# /

#---------------------------------------------------------------------------
# FINALIZE
#---------------------------------------------------------------------------

return(out)

# /FINALIZE ----------
}

</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rappster.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rappster.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rappster.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rappster.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rappster.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rappster.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rappster.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rappster.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rappster.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rappster.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rappster.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rappster.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rappster.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rappster.wordpress.com/60/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rappster.wordpress.com&amp;blog=28361168&amp;post=60&amp;subd=rappster&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rappster.wordpress.com/2011/11/20/indexing-nested-lists/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/64bdf3dbb235368077ba047ad91f7c70?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">songpants</media:title>
		</media:content>
	</item>
		<item>
		<title>Doing away with &#8220;unknown timezone&#8221; warnings</title>
		<link>http://rappster.wordpress.com/2011/11/08/doing-away-with-unknown-timezone-warnings/</link>
		<comments>http://rappster.wordpress.com/2011/11/08/doing-away-with-unknown-timezone-warnings/#comments</comments>
		<pubDate>Tue, 08 Nov 2011 09:30:11 +0000</pubDate>
		<dc:creator>songpants</dc:creator>
				<category><![CDATA[R]]></category>
		<category><![CDATA[r]]></category>
		<category><![CDATA[time]]></category>

		<guid isPermaLink="false">http://rappster.wordpress.com/?p=51</guid>
		<description><![CDATA[Timezone stuff can really drive you NUTS - at least if you&#8217;re sitting in front of a German Windows-Box This is what I used to do to set my tz: And I always wondered why R would throw &#8220;unknown timezone&#8221; warnings: Someday I found out that setting tz via `options()` was not enough as the &#8230; <a href="http://rappster.wordpress.com/2011/11/08/doing-away-with-unknown-timezone-warnings/">Continue reading <span class="meta-nav">&#187;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rappster.wordpress.com&amp;blog=28361168&amp;post=51&amp;subd=rappster&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Timezone stuff can really drive you <strong>NUTS</strong></p>
<p>- at least if you&#8217;re sitting in front of a German Windows-Box <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>This is what I used to do to set my tz:</p>
<p><pre class="brush: r;">

options(tz=&quot;Europe/Berlin&quot;)

</pre></p>
<p>And I always wondered why R would throw &#8220;unknown timezone&#8221; warnings:</p>
<p><pre class="brush: r;">

&gt; t &lt;- &quot;2011-11-08 09:42:00&quot;
 &gt; as.POSIXct(t, tz=getOption(&quot;tz&quot;))
 [1] &quot;2011-11-08 09:42:00 CET&quot;
 Warning messages:
 1: In strptime(xx, f &lt;- &quot;%Y-%m-%d %H:%M:%OS&quot;, tz = tz) :
 unknown timezone 'MET-1MST'
 2: In as.POSIXct.POSIXlt(x) : unknown timezone 'MET-1MST'
 3: In strptime(x, f, tz = tz) : unknown timezone 'MET-1MST'
 4: In as.POSIXct.POSIXlt(as.POSIXlt(x, tz, ...), tz, ...) :
 unknown timezone 'MET-1MST'
 5: In as.POSIXlt.POSIXct(x, tz) : unknown timezone 'MET-1MST'

</pre></p>
<p>Someday I found out that setting tz via `options()` was not enough as the environment variable `TZ` is not affected and hence all the the trouble:</p>
<p><pre class="brush: r;">

&gt; Sys.getenv(&quot;TZ&quot;)
 [1] &quot;MET-1MST&quot;

</pre></p>
<p>Changing this should do away with the nasty warnings:</p>
<p><pre class="brush: r;">

&gt; Sys.setenv(TZ=&quot;Europe/Berlin&quot;)
 &gt; Sys.getenv(&quot;TZ&quot;)
 [1] &quot;Europe/Berlin&quot;
 &gt; as.POSIXct(t, tz=getOption(&quot;tz&quot;))
 [1] &quot;2011-11-08 09:42:00 CET&quot;

</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rappster.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rappster.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rappster.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rappster.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rappster.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rappster.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rappster.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rappster.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rappster.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rappster.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rappster.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rappster.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rappster.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rappster.wordpress.com/51/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rappster.wordpress.com&amp;blog=28361168&amp;post=51&amp;subd=rappster&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rappster.wordpress.com/2011/11/08/doing-away-with-unknown-timezone-warnings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/64bdf3dbb235368077ba047ad91f7c70?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">songpants</media:title>
		</media:content>
	</item>
		<item>
		<title>Identifying Records in Data Frame A That Are Not Contained In Data Frame B &#8211; A Comparison</title>
		<link>http://rappster.wordpress.com/2011/10/12/identifying-records-in-data-frame-a-that-are-not-contained-in-fata-frame-b-a-comparison/</link>
		<comments>http://rappster.wordpress.com/2011/10/12/identifying-records-in-data-frame-a-that-are-not-contained-in-fata-frame-b-a-comparison/#comments</comments>
		<pubDate>Wed, 12 Oct 2011 10:13:46 +0000</pubDate>
		<dc:creator>songpants</dc:creator>
				<category><![CDATA[R]]></category>
		<category><![CDATA[data.frame]]></category>
		<category><![CDATA[join]]></category>
		<category><![CDATA[match]]></category>
		<category><![CDATA[merge]]></category>
		<category><![CDATA[r]]></category>

		<guid isPermaLink="false">http://rappster.wordpress.com/?p=7</guid>
		<description><![CDATA[Yesterday I launched my first question at Stackoverflow and apparently did a lot of things wrong as I managed to get my question closed wihtin hours http://stackoverflow.com/questions/7728462/identify-records-in-data-frame-a-not-contained-in-data-frame-b I had collected 9 different solutions to the problem and made the mistake to put it all within the original question space. So people complained and told me &#8230; <a href="http://rappster.wordpress.com/2011/10/12/identifying-records-in-data-frame-a-that-are-not-contained-in-fata-frame-b-a-comparison/">Continue reading <span class="meta-nav">&#187;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rappster.wordpress.com&amp;blog=28361168&amp;post=7&amp;subd=rappster&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Yesterday I launched my first question at Stackoverflow and apparently did a lot of things wrong as I managed to get my question closed wihtin hours <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p><a title="Stack" href="http://stackoverflow.com/questions/7728462/identify-records-in-data-frame-a-not-contained-in-data-frame-b" target="_blank">http://stackoverflow.com/questions/7728462/identify-records-in-data-frame-a-not-contained-in-data-frame-b</a></p>
<p>I had collected 9 different solutions to the problem and made the mistake to put it all within the original question space. So people complained and told me that such a collection belongs into a blog and not on Stackoverflow. Hence, I decided to go ahead and finally make my first blogging steps! I&#8217;ll probably still miss out on a lot of cool technical stuff on the blog, so please bear with me.</p>
<p>So here&#8217;s the thing:</p>
<h2>Problem</h2>
<p>How to identify records/rows in data frame <code>x.1</code> that are <strong>not</strong> contained in data frame <code>x.2</code> based on <strong>all</strong> attributes available (i.e. all columns) in the <strong>most efficient</strong> way?</p>
<h2>Example Data</h2>
<p><pre class="brush: r;">
&gt; x.1 &lt;- data.frame(a=c(1,2,3,4,5), b=c(1,2,3,4,5))
&gt; x.1
a b
1 1 1
2 2 2
3 3 3
4 4 4
5 5 5

&gt; x.2 &lt;- data.frame(a=c(1,1,2,3,4), b=c(1,1,99,3,4))
&gt; x.2
a  b
1 1  1
2 1  1
3 2 99
4 3  3
5 4  4

# BENCHMARK SETTINGS
require(microbenchmark)
to.sec &lt;- 1000000000
</pre></p>
<h2>Desired Result</h2>
<p><pre class="brush: r;">

  a b
2 2 2
5 5 5
</pre></p>
<h2>Best Solution So Far</h2>
<p>by Prof. Brian Ripley and <a title="Gabor Grothendieck" href="http://stackoverflow.com/users/516548/g-grothendieck">Gabor Grothendieck</a></p>
<p><pre class="brush: r;">
&gt; fun.12 &lt;- function(x.1,x.2,...){
+     x.1p &lt;- do.call(&quot;paste&quot;, x.1)
+     x.2p &lt;- do.call(&quot;paste&quot;, x.2)
+     x.1[! x.1p %in% x.2p, ]
+ }
&gt; fun.12(x.1,x.2)
  a b
2 2 2
5 5 5
&gt; sol.12 &lt;- microbenchmark(fun.12(x.1,x.2))
&gt; sol.12 &lt;- median(sol.12$time)/to.sec
&gt; sol.12
&gt; [1] 0.0002059665
</pre></p>
<h2>Efficiency Comparison</h2>
<p><pre class="brush: r;">
&gt; sol.scope &lt;- 1:13
&gt; comp &lt;- data.frame(lapply(sol.scope, function(x){
+     eval(substitute(get(SOL), list(SOL=paste(&quot;sol.&quot;, x, sep=&quot;&quot;))))
+ }))
&gt; names(comp) &lt;- paste(&quot;solution&quot;, sol.scope)
&gt; comp &lt;- as.data.frame(t(comp[order(comp[1,])]))
&gt; colnames(comp) &lt;- &quot;time&quot;
&gt; comp
time   time.rel
solution 12 0.0002080150   1.000000
solution 3  0.0002548310   1.225061
solution 1  0.0004656785   2.238677
solution 10 0.0006398950   3.076196
solution 6  0.0007878430   3.787434
solution 8  0.0010459795   5.028385
solution 11 0.0021617355  10.392210
solution 9  0.0025755710  12.381660
solution 7  0.0103444610  49.729399
solution 13 0.0211265200 101.562483
solution 5  0.0225685395 108.494770
solution 2            NA         NA
solution 4            NA         NA
</pre></p>
<p>Here are all the solutions I collected so far:</p>
<h2>Solution 1</h2>
<p>by <a title="Chase" href="http://stackoverflow.com/users/415635/chase">Chase</a></p>
<p><pre class="brush: r;">
&gt; fun.1 &lt;- function(x.1,x.2,...){
+     expr &lt;- paste(&quot;subset(x.1,&quot;, paste(sapply(names(x.1), function(x){
+         paste(&quot;!(&quot;, x, &quot; %in% x.2$&quot;, x, &quot;)&quot;, sep=&quot;&quot;)
+     }), collapse=&quot; | &quot;), &quot;)&quot;)
+     eval(parse(text=expr))
+ }
&gt; fun.1(x.1,x.2)
a b
2 2 2
5 5 5
&gt; sol.1 &lt;- microbenchmark(fun.1(x.1,x.2))
&gt; sol.1 &lt;- median(sol.1$time)/to.sec
&gt; sol.1
[1] 0.0004656785
</pre></p>
<h2>Solution 2 (rather just an approach)</h2>
<p>by <a title="Ramnath" href="http://stackoverflow.com/users/235349/ramnath">Ramnath</a></p>
<p><pre class="brush: r;">
&gt; setdiff(x.1$a, x.2$a)   # elements in x.1$a NOT in x.2$a
[1] 5
&gt; setdiff(x.2$a, x.1$a)   # elements in x.2$a NOT in x.1$a
numeric(0)
&gt; sol.2 &lt;- microbenchmark(setdiff(x.1$a, x.2$a))
&gt; sol.2 &lt;- median(sol.2$time)/to.sec
&gt; sol.2
[1] 4.03865e-05
# This helps, but as it does not directly provide the solution, we will set this to 'NA'
sol.2 &lt;- NA
</pre></p>
<h2>Solution 3</h2>
<p>by Prof. Brian Ripley</p>
<p><pre class="brush: r;">
&gt; fun.3 &lt;- function(x.1, x.2, ...){
+     x.1.id &lt;- do.call(&quot;paste&quot;, c(x.1, sep = &quot;\r&quot;))
+     x.2.id &lt;- do.call(&quot;paste&quot;, c(x.2, sep = &quot;\r&quot;))
+     x.1[match(setdiff(x.1.id, x.2.id),x.1.id), ]
+ }
&gt; fun.3(x.1,x.2)
a b
1 2 2
2 5 5
&gt; sol.3 &lt;- microbenchmark(fun.3(x.1,x.2))
&gt; sol.3 &lt;- median(sol.3$time)/to.sec
&gt; sol.3
[1] 0.000254831
</pre></p>
<h2>Solution 4 (rather just an approach)</h2>
<p>by me</p>
<p><pre class="brush: r;">
&gt; fun.4 &lt;- function(x.1, x.2, ...){
+     # Combine
+     df &lt;- rbind(x.1,x.2)
+     df &lt;- df[order(df[,1]),]
+     # Find duplicates
+     idx.1 &lt;- duplicated(df, all=TRUE)
+     idx.2 &lt;- duplicated(df, fromLast=TRUE)
+     idx &lt;- cbind(idx.1, idx.2)
+     idx &lt;- apply(idx, MARGIN=1, any)
+     # Index records
+     df[-which(idx),]
+ }
&gt; fun.4(x.1,x.2)
a b
1 2 2
8 2 99
2 5 5
&gt; sol.4 &lt;- microbenchmark(fun.4(x.1,x.2))
&gt; sol.4 &lt;- median(sol.4$time)/to.sec
&gt; sol.4
[1] 0.001062621
# As it does not match the desired records, we set this to 'NA'
sol.4 &lt;- NA
</pre></p>
<h2>Solution 5</h2>
<p>base on solution by <a title="Gabor Grothendieck" href="http://stackoverflow.com/users/516548/g-grothendieck">Gabor Grothendieck</a></p>
<p><pre class="brush: r;">
&gt; library(sqldf)
&gt; fun.5 &lt;- function(x1,x2,...){
+     out &lt;- sqldf(
+         &quot;SELECT * FROM x1
+             WHERE
+                 x1.a NOT IN (SELECT x2.a FROM x2) OR
+                 x1.b NOT IN (SELECT x2.b FROM x2)&quot;
+     )
+     out
+ }
&gt; fun.5(x1=x.1,x2=x.2)
a b
1 2 2
2 5 5
&gt; sol.5 &lt;- microbenchmark(fun.5(x1=x.1,x2=x.2))
&gt; sol.5 &lt;- median(sol.5$time)/to.sec
&gt; sol.5
[1] 0.02256854
</pre></p>
<h2>Solution 6</h2>
<p>by <a title="Tal Galili" href="http://stackoverflow.com/users/256662/tal-galili">Tal Galili</a></p>
<p><pre class="brush: r;">
&gt; fun.6 &lt;- function(x.1,x.2){
+     x.1.vec &lt;- apply(x.1, 1, paste, collapse = &quot;&quot;)
+     x.2.vec &lt;- apply(x.2, 1, paste, collapse = &quot;&quot;)
+     x.1.without.x.2.rows &lt;- x.1[!x.1.vec %in% x.2.vec,]
+     return(x.1.without.x.2.rows)
+ }
&gt; fun.6(x.1,x.2)
a b
1 2 2
2 5 5
&gt; sol.6 &lt;- microbenchmark(fun.6(x.1,x.2))
&gt; sol.6 &lt;- median(sol.6$time)/to.sec
&gt; sol.6
[1] 0.000787843
</pre></p>
<h2>Solution 7</h2>
<p>by <a title="nullglob" href="http://stackoverflow.com/users/356426/nullglob">nullglob</a></p>
<p><pre class="brush: r;">
# COULD NOT REPRODUCE RESULTS WITH MY DATA
&gt; fun.7 &lt;- function(x.1,x.2,...){
+     a1 &lt;- data.frame(a = 1:5, b = letters[1:5])
+     a2 &lt;- data.frame(a = 1:3, b = letters[1:3])
+     comparison &lt;- compare(a1,a2,allowAll=TRUE)
+     comparison$tM
+     difference &lt;-
+         data.frame(lapply(1:ncol(a1),function(i)setdiff(a1[,i],comparison$tM[,i])))
+     colnames(difference) &lt;- colnames(a1)
+     difference
+ }
&gt; fun.7(x.1,x.2)
  a b
1 4 d
2 5 e
&gt; ### DISCUSSION ###
&gt; # 1) Effectiveness
&gt; # Could not reproduce results with my data frames.
&gt; # 2) Efficiency
&gt; sol.7 &lt;- microbenchmark(fun.7(x.1,x.2))
&gt; sol.7 &lt;- median(sol.7$time)/to.sec
&gt; sol.7
[1] 0.01034446
</pre></p>
<h2>Solution 8</h2>
<p>by <a title="Henrico" href="http://stackoverflow.com/users/298490/henrico">Henrico</a></p>
<p><pre class="brush: r;">
#  Derived from src/library/base/R/merge.R
#  Part of the R package, http://www.R-project.org
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  A copy of the GNU General Public License is available at
#  http://www.r-project.org/Licenses/
&gt; XinY &lt;-
+     function(x, y, by = intersect(names(x), names(y)), by.x = by, by.y = by,
+              notin = FALSE, incomparables = NULL,
+              ...)
+ {
+     fix.by &lt;- function(by, df)
+     {
+         ## fix up 'by' to be a valid set of cols by number: 0 is row.names
+         if(is.null(by)) by &lt;- numeric(0L)
+         by &lt;- as.vector(by)
+         nc &lt;- ncol(df)
+         if(is.character(by))
+             by &lt;- match(by, c(&quot;row.names&quot;, names(df))) - 1L
+         else if(is.numeric(by)) {
+             if(any(by &lt; 0L) || any(by &gt; nc))
+                 stop(&quot;'by' must match numbers of columns&quot;)
+         } else if(is.logical(by)) {
+             if(length(by) != nc) stop(&quot;'by' must match number of columns&quot;)
+             by &lt;- seq_along(by)[by]
+         } else stop(&quot;'by' must specify column(s) as numbers, names or logical&quot;)
+         if(any(is.na(by))) stop(&quot;'by' must specify valid column(s)&quot;)
+         unique(by)
+     }
+     nx &lt;- nrow(x &lt;- as.data.frame(x)); ny &lt;- nrow(y &lt;- as.data.frame(y))
+     by.x &lt;- fix.by(by.x, x)
+     by.y &lt;- fix.by(by.y, y)
+     if((l.b &lt;- length(by.x)) != length(by.y))
+         stop(&quot;'by.x' and 'by.y' specify different numbers of columns&quot;)
+     if(l.b == 0L) {
+         ## was: stop(&quot;no columns to match on&quot;)
+         ## returns x
+         x
+     }
+     else {
+         if(any(by.x == 0L)) {
+             x &lt;- cbind(Row.names = I(row.names(x)), x)
+             by.x &lt;- by.x + 1L
+         }
+         if(any(by.y == 0L)) {
+             y &lt;- cbind(Row.names = I(row.names(y)), y)
+             by.y &lt;- by.y + 1L
+         }
+         ## create keys from 'by' columns:
+         if(l.b == 1L) {                  # (be faster)
+             bx &lt;- x[, by.x]; if(is.factor(bx)) bx &lt;- as.character(bx)
+             by &lt;- y[, by.y]; if(is.factor(by)) by &lt;- as.character(by)
+         } else {
+             ## Do these together for consistency in as.character.
+             ## Use same set of names.
+             bx &lt;- x[, by.x, drop=FALSE]; by &lt;- y[, by.y, drop=FALSE]
+             names(bx) &lt;- names(by) &lt;- paste(&quot;V&quot;, seq_len(ncol(bx)), sep=&quot;&quot;)
+             bz &lt;- do.call(&quot;paste&quot;, c(rbind(bx, by), sep = &quot;\r&quot;))
+             bx &lt;- bz[seq_len(nx)]
+             by &lt;- bz[nx + seq_len(ny)]
+         }
+         comm &lt;- match(bx, by, 0L)
+         if (notin) {
+             res &lt;- x[comm == 0,]
+         } else {
+             res &lt;- x[comm &gt; 0,]
+         }
+     }
+     ## avoid a copy
+     ## row.names(res) &lt;- NULL
+     attr(res, &quot;row.names&quot;) &lt;- .set_row_names(nrow(res))
+     res
+ }
&gt; XnotinY &lt;-
+     function(x, y, by = intersect(names(x), names(y)), by.x = by, by.y = by,
+              notin = TRUE, incomparables = NULL,
+              ...)
+ {
+     XinY(x,y,by,by.x,by.y,notin,incomparables)
+ }
&gt; fun.8 &lt;- XnotinY
&gt; fun.8(x.1,x.2)
a b
1 2 2
2 5 5
&gt; sol.8 &lt;- microbenchmark(fun.8(x.1,x.2))
&gt; sol.8 &lt;- median(sol.8$time)/to.sec
&gt; sol.8
[1] 0.00104598
</pre></p>
<h2>Solution 9</h2>
<p>by <a title="Tomas T." href="http://stackoverflow.com/users/684229/tomas-t">Tomas T.</a></p>
<p><pre class="brush: r;">
&gt; fun.9 &lt;- function(x.1,x.2,...){
+     tmp = merge(x.1, cbind(x.2, q=1:nrow(x.2)), all.x = TRUE)
+         # provided that there's no column q in both dataframes
+     tmp[is.na(tmp$q), 1:ncol(x.1)] # the result
+ }
&gt; fun.9(x.1,x.2)
a b
1 2 2
2 5 5
&gt; sol.9 &lt;- microbenchmark(fun.9(x.1,x.2))
&gt; sol.9 &lt;- median(sol.9$time)/to.sec
&gt; sol.9
[1] 0.002575571
</pre></p>
<h2>Solution 10</h2>
<p>by <a title="Gabor Grothendieck" href="http://stackoverflow.com/users/516548/g-grothendieck">Gabor Grothendieck</a></p>
<p><pre class="brush: r;">
&gt; fun.10 &lt;- function(x.1,x.2,...){
+     x.1[!duplicated(rbind(x.2, x.1))[-(1:nrow(x.2))],]
+ }
&gt; fun.10(x.1,x.2)
a b
1 2 2
2 5 5
&gt; sol.10 &lt;- microbenchmark(fun.10(x.1,x.2))
&gt; sol.10 &lt;- median(sol.10$time)/to.sec
&gt; sol.10
[1] 0.000639895
</pre></p>
<h2>Solution 11</h2>
<p>by <a title="Gabor Grothendieck" href="http://stackoverflow.com/users/516548/g-grothendieck">Gabor Grothendieck</a></p>
<p><pre class="brush: r;">
&gt; fun.11 &lt;- function(x.1,x.2,...){
+     do.call(&quot;rbind&quot;, setdiff(split(x.1, rownames(x.1)), split(x.2, rownames(x.2))))
+ }
&gt; fun.11(x.1,x.2)
a b
1 2 2
2 5 5
&gt; sol.11 &lt;- microbenchmark(fun.11(x.1,x.2))
&gt; sol.11 &lt;- median(sol.11$time)/to.sec
&gt; sol.11
[1] 0.002161735
</pre></p>
<h2>Solution 12</h2>
<p>by <a title="Gabor Grothendieck" href="http://stackoverflow.com/users/516548/g-grothendieck">Gabor Grothendieck</a></p>
<p><pre class="brush: r;">
&gt; fun.12 &lt;- function(x.1,x.2,...){
+     x.1p &lt;- do.call(&quot;paste&quot;, x.1)
+     x.2p &lt;- do.call(&quot;paste&quot;, x.2)
+     x.1[! x.1p %in% x.2p, ]
+ }
&gt; fun.12(x.1,x.2)
a b
1 2 2
2 5 5
&gt; sol.12 &lt;- microbenchmark(fun.12(x.1,x.2))
&gt; sol.12 &lt;- median(sol.12$time)/to.sec
&gt; sol.12
[1] 0.000208015
</pre></p>
<h2>Solution 13</h2>
<p>by <a title="Gabor Grothendieck" href="http://stackoverflow.com/users/516548/g-grothendieck">Gabor Grothendieck</a></p>
<p><pre class="brush: r;">
&gt; library(sqldf)
&gt; fun.13 &lt;- function(x.1,x.2,...){
+     sqldf(&quot;select * from `x.1` except select * from `x.2`&quot;)
+ }
&gt; fun.13(x.1,x.2)
a b
1 2 2
2 5 5
&gt; sol.13 &lt;- microbenchmark(fun.13(x.1,x.2))
&gt; sol.13 &lt;- median(sol.13$time)/to.sec
&gt; sol.13
[1] 0.02112652
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rappster.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rappster.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rappster.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rappster.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rappster.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rappster.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rappster.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rappster.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rappster.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rappster.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rappster.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rappster.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rappster.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rappster.wordpress.com/7/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rappster.wordpress.com&amp;blog=28361168&amp;post=7&amp;subd=rappster&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rappster.wordpress.com/2011/10/12/identifying-records-in-data-frame-a-that-are-not-contained-in-fata-frame-b-a-comparison/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/64bdf3dbb235368077ba047ad91f7c70?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">songpants</media:title>
		</media:content>
	</item>
		<item>
		<title>Online</title>
		<link>http://rappster.wordpress.com/2011/10/12/online/</link>
		<comments>http://rappster.wordpress.com/2011/10/12/online/#comments</comments>
		<pubDate>Wed, 12 Oct 2011 09:07:13 +0000</pubDate>
		<dc:creator>songpants</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[r]]></category>

		<guid isPermaLink="false">http://rappster.wordpress.com/?p=4</guid>
		<description><![CDATA[Hello world, I decided to start blogging a bit to throw my weird R code examples at you ;-) Hope you&#8217;ll like it! Greetz, Janko<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rappster.wordpress.com&amp;blog=28361168&amp;post=4&amp;subd=rappster&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hello world,</p>
<p>I decided to start blogging a bit to throw my weird R code examples at you ;-)</p>
<p>Hope you&#8217;ll like it!</p>
<p>Greetz,</p>
<p>Janko</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rappster.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rappster.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rappster.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rappster.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rappster.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rappster.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rappster.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rappster.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rappster.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rappster.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rappster.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rappster.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rappster.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rappster.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rappster.wordpress.com&amp;blog=28361168&amp;post=4&amp;subd=rappster&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rappster.wordpress.com/2011/10/12/online/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/64bdf3dbb235368077ba047ad91f7c70?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">songpants</media:title>
		</media:content>
	</item>
	</channel>
</rss>
