<?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:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
	xmlns:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>Micah Elliott &#187; r</title>
	<atom:link href="http://micahelliott.com/tag/r/feed/" rel="self" type="application/rss+xml" />
	<link>http://micahelliott.com</link>
	<description>Stories from my Startup Journey</description>
	<lastBuildDate>Mon, 29 Nov 2010 07:46:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
<image>
  <link>http://micahelliott.com</link>
  <url>http://micahelliott.com/mde-gravatar7.png</url>
  <title>Micah Elliott</title>
</image>
	<!-- podcast_generator="podPress/8.8" - maintenance_release="8.8.6.3" -->
	<copyright>Copyright &#38;#xA9; Micah Elliott 2010 </copyright>
	<managingEditor>mde@micahelliott.com (Micah Elliott)</managingEditor>
	<webMaster>mde@micahelliott.com (Micah Elliott)</webMaster>
	<category>posts</category>
	<image>
		<url>http://micahelliott.com/wp-content/plugins/podpress/images/powered_by_podpress.jpg</url>
		<title>Micah Elliott &#187; r</title>
		<link>http://micahelliott.com</link>
		<width>144</width>
		<height>144</height>
	</image>
	<itunes:subtitle></itunes:subtitle>
	<itunes:summary>Stories from my Startup Journey</itunes:summary>
	<itunes:keywords></itunes:keywords>
	<itunes:category text="Society &amp; Culture" />
	<itunes:author>Micah Elliott</itunes:author>
	<itunes:owner>
		<itunes:name>Micah Elliott</itunes:name>
		<itunes:email>mde@micahelliott.com</itunes:email>
	</itunes:owner>
	<itunes:block>no</itunes:block>
	<itunes:explicit>no</itunes:explicit>
	<itunes:image href="http://micahelliott.com/wp-content/plugins/podpress/images/powered_by_podpress_large.jpg" />
		<item>
		<title>Considering R as a Python Supplement</title>
		<link>http://micahelliott.com/2009/03/considering-r-as-python-supplement/</link>
		<comments>http://micahelliott.com/2009/03/considering-r-as-python-supplement/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 18:00:12 +0000</pubDate>
		<dc:creator>Micah</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[languages]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[r]]></category>

		<guid isPermaLink="false">http://micahelliott.com/?p=311</guid>
		<description><![CDATA[It&#8217;s quite an investment to pick up a new programming language (syntax, semantics, types), along with all its periphery: tools, libraries, interfaces, environment, documentation, culture, user groups, history, idioms, and quirks.  I&#8217;m not trying to force myself to learn a new language every year, though looking back it&#8217;s pretty much turned out that way.  I [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s quite an investment to pick up a new programming language (syntax, semantics, types), along with all its periphery: tools, libraries, interfaces, environment, documentation, culture, user groups, history, idioms, and quirks.  I&#8217;m not trying to force myself to <a href="http://www.perlmonks.org/?node_id=397542">learn a new language every year</a>, though looking back it&#8217;s pretty much turned out that way.  I actually think there&#8217;s a skill-diluting effect in going shallow and trying to memorize syntax for a breadth of languages without knowing much about those other necessary peripheral pieces.  You really need a native language as a foundation by which you judge the others.  That may consist of a few, but I think there must be a small core.  Over the years my primary foundation has become Python.  I actually tend to steer away from the majority of new languages (especially since I rarely get into a situation where Python won&#8217;t handle the job), though the temptation of the new is sometimes great.  This year I&#8217;m having an especially hard time holding back the urge for the new.  It&#8217;s <a href="http://www.r-project.org/"><strong>R</strong></a>.  I&#8217;ve spent the last month telling myself I can&#8217;t make the commitment now given <a href="http://micahelliott.com/2009/01/reasons-for-creating-a-business/">how critical my development momentum is</a> to survival.  Well, R keeps taunting me, showing up <a href="http://en.wikipedia.org/wiki/23_Enigma">everywhere I look</a>.  I&#8217;ve got to figure out why it won&#8217;t leave me alone.  So here are the compelling pieces I&#8217;ve discovered thus far about R, that have me tinkering in its <a href="http://en.wikipedia.org/wiki/REPL">REPL</a>, wanting to buy <a href="http://www.amazon.com/Interactive-Dynamic-Graphics-Data-Analysis/dp/0387717617/">book</a> after <a href="http://www.amazon.com/Handbook-Statistical-Analyses-Using-R/dp/1584885394">book</a>, and even <a href="http://www.ggobi.org/demos/tour.html">having some strange dreams</a>.  I&#8217;m trying to compare to Python to evaluate the investment in learning another new language.<span id="more-311"></span></p>
<p>Here are some great things I&#8217;ve discovered about R:</p>
<ul>
<li><strong>Functional.</strong> Although <a href="http://micahelliott.com/2008/06/a-single-command-to-get-started-on-functional-programming/">I&#8217;ve dabbled in Erlang, Haskell, and ML</a>, and grown towards using Python in various functional ways (<a href="http://www.ibm.com/developerworks/library/l-prog.html">Mertz</a>, <a href="http://www.amk.ca/python/writing/functional">AMK</a>), I can&#8217;t say I&#8217;m <em>fluent</em> in any sanctioned <a href="http://en.wikipedia.org/wiki/Category:Functional_languages">functional language</a> (okay, I just added R to that list, but <a href="http://www.ibm.com/developerworks/linux/library/l-r2/">it should have been there</a>: &#8220;R&#8217;s functional parts come from Scheme.&#8221;)  I want to continue &#8220;breaking my brain in useful and creative ways&#8221;, and R fits the bill for completing this repertory need (I&#8217;ll probably head back to Haskell if/when a strong need for concurrency arises).</li>
<li><strong>Statistics and data analysis.</strong> <a href="http://www.amazon.com/Numerati-Stephen-Baker/dp/0618784608">The Numerati</a> and <a href="http://www.mckinseyquarterly.com/Hal_Varian_on_how_the_Web_challenges_managers_2286">other sources</a> say statisticians rule the world.  My eyes have been opened and I believe they&#8217;re right, so I&#8217;m working back my math chops.  It would appear that R&#8217;s statistics packages are more expansive than Python&#8217;s, and more is built into the language itself.</li>
<li><strong>Mathematical learning tool.</strong> It&#8217;s been a decade since I finished that math degree, but now the investment is finally paying off&#8230; I, uh, hypothesize.  I&#8217;ll blame the hiatus on not having found very interesting work to do until now &#8212; another reason to be self-employed, and why I&#8217;m loving life this year.  Anyway, I&#8217;m already getting re-versed in stats just by starting to use the language.  It&#8217;s looking like playing with R is a much better way to learn statistics than muddling through textbooks and paper-based homework.</li>
<li><strong>Graphical.</strong> Don&#8217;t know where to start.  There are <a href="http://en.wikipedia.org/wiki/R_(programming_language)#Graphical_user_interfaces">so many graphical tools</a> for R it is mind-numbing.  I&#8217;m starting to look at <a href="http://www.ggobi.org/rggobi/">RGgobi</a>, but there are lots of others to get acquainted with, including what&#8217;s built in.  I&#8217;ve worked through a couple graphical tutorials, and they seem to just magically pop up amazing graphs without having installed anything.  Try: <code>&gt; demo('graphics')</code> Notice how few lines of code are doing all that. Wow!</li>
<li><strong>Geospatial.</strong> I&#8217;ve got a need to be plotting data on maps in a variety of formats.  I&#8217;ve <a href="http://delicious.com/mdelliot/visual">found a lot of ways to do this</a>, but R seems to be the lightest, and <a href="http://grass.itc.it/">very capable</a>.</li>
<li><strong>High-level. </strong> Everything is a data structure.  Operations applied to variables are done across the whole set with no loops or treatment of individual items.  The syntax appears to be a bit richer (higher level, more sugar) than found in Python.</li>
<li><strong>I/O.</strong> R seamlessly slurps table-oriented text files for processing.  Output is also automatically formatted in nice text tables.  A mini-book (<a href="http://cran.r-project.org/doc/manuals/R-data.pdf">PDF</a>) describes this and much more.  My next learning task is to start <a href="http://rpgsql.sourceforge.net/">interfacing with PostgreSQL</a>.</li>
<li><strong>Kind of Python-like.</strong> I&#8217;ve started outlining another article that I hope to actually write someday called &#8220;R For Python Programmers&#8221; (since I can&#8217;t find such a guide).  Isn&#8217;t Python the gold standard to which <a href="http://www.amazon.com/Real-World-Haskell-Bryan-OSullivan/dp/0596514980/">great books</a> make comparisons these days?  I won&#8217;t duplicate that here, but simply say that I can&#8217;t believe how comfortable the syntax feels coming from Python nativity.  And R appears to <a href="http://rpy.sourceforge.net/">integrate very well with Python</a> (this probably being the more important point).</li>
<li><strong>Best REPL evar!</strong> I start evaluating any language simply by firing up its REPL and comparing its facilities to those of <a href="http://ipython.scipy.org">IPython</a>.  R&#8217;s REPL is on par with it (readline editing with vim-mode support, tab completion for everything, extensive help), and even has some extra niceties; e.g., function parameter tab-completion.  While getting started, note that the help system uses <code>?</code> and <code>??</code> <em>prefixes</em> instead of IPython&#8217;s suffix notation.  IOW, use <code>?topic</code> instead of <code>topic?</code> I&#8217;m getting the impression that a common workflow is spending lots of time in the REPL working with files and graphics.  This is probably the killer feature that enables me to quickly get up to speed.</li>
<li><strong>Documentation.</strong> The pages aren&#8217;t pretty, but there is a mass of info on the R site.  And AFAICT R is the foremost language used in recent Statistics textbooks.  There&#8217;s also a free 100-page (a good length, compare to Python Tutorial) <a href="http://cran.r-project.org/doc/manuals/R-intro.html">intro book</a>.  It&#8217;s horrible for non-programmers, and less than perfect for non-statisticians, but will get you familiar with some language features.  Appendix A offers a nice REPL walk-thru of language features.  I can&#8217;t find any Python books with much treatment of numerics, except for <a href="http://www.amazon.com/Python-Scripting-Computational-Science-Engineering/dp/3540739157">this one</a> which seems to touch on some but shares space with language basics.</li>
<li><strong>CRAN.</strong> Incredibly diverse libraries (<a href="http://cran.r-project.org/web/packages/">list of packages</a>) for statistics, graphics, and even <a href="http://www.medepi.net/epir/">Epidemiology</a> (probably overkill for my present needs).</li>
<li><strong>Mature and well-designed.</strong> R has been growing as the de facto FOSS statistical/graphical language <a href="http://cran.r-project.org/doc/html/interface98-paper/paper.html">for over a decade</a> (inception in 1993, in <a href="http://micahelliott.com/2008/06/1983-96-the-golden-age-of-programming-languages/">the golden age</a>).  It has grown up from the learnings of its ancestor <a href="http://en.wikipedia.org/wiki/S_(programming_language)">S</a> (shouldn&#8217;t R then be T??; I guess similar to C-&gt;B-&gt;A progression), which came onto the scene circa 1976 (a good year <img src='http://micahelliott.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> .</li>
<li><strong>Widely used.</strong> A survey of university statistics courses and Public Health curricula show R as a prevalent tool; e.g., UC Berkeley and Iowa State.</li>
<li><strong>UNIX-friendly.</strong> I was humored to see that R is more apt to borrow names from UNIX commands than from other languages.  The commands for managing a namespace are <code>rm</code> and <code>ls</code> &#8212; easy for me to remember. <img src='http://micahelliott.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />   And I&#8217;m glad to see it has good roots.</li>
<li><strong>Trivial Ubuntu installation.</strong> Try this: <code>apt-get install r-recommended r-cran-&lt;tab&gt;&lt;tab&gt;</code></li>
<li><strong>Script-friendly.</strong> Rscript enables R to act as a scripting language.</li>
<li><strong>PDX-visualization group.</strong> This month we&#8217;re starting up <a href="http://micahelliott.com/2009/03/getting-started-with-graphviz/">a group to discuss visualization technology/advances</a>, and R will be the primary language under discussion.  My statistician friend, <a href="http://twitter.com/znmeb">Ed</a>, won&#8217;t stop talking about R, and he&#8217;s someone I&#8217;ve come to listen intently to.</li>
</ul>
<p>It&#8217;s a bit early to be writing an article on a language I haven&#8217;t done much with yet.  But I had to explore what&#8217;s pushing me towards R.  Looks pretty compelling now, so I&#8217;m very close to diving in (actually using it in a project).  I&#8217;ve sprinkled a number of resources throughout this post which I hope will be helpful for newcomers to R (including myself).  I should also mention that the best articles I&#8217;ve seen on introducing R are by David Mertz (a very capable Pythonista): Statistical Programming with R, <a href="http://www.ibm.com/developerworks/linux/library/l-r1/">Part I</a> and <a href="http://www.ibm.com/developerworks/linux/library/l-r2/">Part II</a>.</p>
<p>I can&#8217;t ignore what&#8217;s been growing out of  <a href="http://www.scipy.org">Scipy</a>, especially the <a href="http://www.scipy.org/Cookbook/Matplotlib/Maps">maps</a>.  And <a href="http://matplotlib.sourceforge.net/gallery.html">matplotlib&#8217;s gallery</a> is incredible (and I have some of them working).  The above items are all great features of R, but if I can accomplish them nearly as well in Python I probably shouldn&#8217;t invest too much into R.  At this point it does appear that R offers some facilities beyond Python.  <em>Have you worked with both Python and R and found compelling reasons to prefer R?  For which types of tasks?</em></p>
<p>My pain points with Python today are in analyzing query data (ad hoc in loops and heuristics), and creating a bunch of different formats to send to various third-party visualizations.  My analysis is going to need to get more sophisticated, and I&#8217;d like to be able to look at data visually quickly with less overhead.</p>
<p>I&#8217;m probably overstating the investment required in getting up and running with R; it&#8217;s <a href="http://www.nytimes.com/2009/01/07/technology/business-computing/07program.html">supposed to be easy to pick up</a>.  I&#8217;d really like to get to being comfortable with applying <a href="http://en.wikipedia.org/wiki/Statistics">non-trivial statistics</a>, which means working through some R books.  I&#8217;ve made it this far (and now so have you), so I&#8217;m going for it, hoping it will be a pretty quick learn.  <em>Please feel free to share your experiences with learning and using R!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://micahelliott.com/2009/03/considering-r-as-python-supplement/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

