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

<channel>
	<title>Cerebral Mastication &#187; apply</title>
	<atom:link href="http://www.cerebralmastication.com/tag/apply/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cerebralmastication.com</link>
	<description>Something to Chew On</description>
	<lastBuildDate>Fri, 16 Jul 2010 22:07:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Struggling with apply() in R</title>
		<link>http://www.cerebralmastication.com/2009/12/struggling-with-apply-in-r/</link>
		<comments>http://www.cerebralmastication.com/2009/12/struggling-with-apply-in-r/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 19:30:55 +0000</pubDate>
		<dc:creator>JD Long</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apply]]></category>
		<category><![CDATA[plyr]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://www.cerebralmastication.com/?p=432</guid>
		<description><![CDATA[It&#8217;s common knowledge that I struggle wrapping my head around the apply functions in R. That is illustrated very clearly in the following discussion on Stack Overflow:

Dirk&#8217;s comment is actually spot on. I&#8217;ve asked the same damn question at least 4-5 times. Only I didn&#8217;t really understand it was the same question. That&#8217;s one of [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s common knowledge that I struggle wrapping my head around the apply functions in R. That is illustrated very clearly in the <a href="http://stackoverflow.com/questions/1355355/how-to-avoid-a-loop-in-r-selecting-items-from-a-list" onclick="pageTracker._trackPageview('/outgoing/stackoverflow.com/questions/1355355/how-to-avoid-a-loop-in-r-selecting-items-from-a-list?referer=');">following discussion </a>on Stack Overflow:</p>
<p><a href="http://stackoverflow.com/questions/1355355/how-to-avoid-a-loop-in-r-selecting-items-from-a-list" onclick="pageTracker._trackPageview('/outgoing/stackoverflow.com/questions/1355355/how-to-avoid-a-loop-in-r-selecting-items-from-a-list?referer=');"><img class="alignnone size-full wp-image-433" style="border: 2px solid black; margin: 2px;" title="apply_struggle" src="http://www.cerebralmastication.com/wp-content/uploads/2009/12/apply_struggle.PNG" alt="apply_struggle" width="536" height="217" /></a></p>
<p>Dirk&#8217;s comment is actually spot on. I&#8217;ve asked the same damn question at least 4-5 times. Only I didn&#8217;t really understand it was the same question. That&#8217;s one of the problems of not really being good at something; it&#8217;s hard to think abstractly about it. I&#8217;m not really good at R, so sometimes I don&#8217;t realize that multiple concepts are related. As I talk with other new users of R it&#8217;s clear that unless they come from a programming language with an apply-esque construct they likely are struggling with R. I think most of the confusion comes from a) not understanding what data format apply() is going to return and b) not understanding anonymous functions.</p>
<p>With this in mind I did a little screencast illustrating how this struggle plays out for a new users. I also show why I use the plyr package for much of the stuff other folks use apply() for.</p>
<p>Any feedback you have is appreciated. This is my first stab at a screencast, so I am still trying to figure out the best approach/method as well as how many drinks puts me on the <a href="http://xkcd.com/323/" onclick="pageTracker._trackPageview('/outgoing/xkcd.com/323/?referer=');">Ballmer Peak</a>.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="350" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.youtube.com/v/tdoIwXT_lP8" /><embed type="application/x-shockwave-flash" width="425" height="350" src="http://www.youtube.com/v/tdoIwXT_lP8"></embed></object></p>
<p><strong>EDIT</strong>: it&#8217;s been pointed out that I misuse some terminology a number of times. I should have named my year vector &#8220;yearVector.&#8221; By calling it &#8220;yearList&#8221; I then refer to the vector as a list. I was using &#8220;list&#8221; in the vernacular, but since list is a specific R data structure it is confusing that I named a vector a name with &#8220;list&#8221; in it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cerebralmastication.com/2009/12/struggling-with-apply-in-r/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>
