<?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>OUseful.Info, the blog... &#187; More Shiny Goodness &#8211; Tinkering With the Ergast Motor Racing Data API</title>
	<atom:link href="http://blog.ouseful.info/2012/12/04/more-shiny-goodness-tinkering-with-the-ergast-motor-racing-data-api/feed/?withoutcomments=1" rel="self" type="application/rss+xml" />
	<link>http://blog.ouseful.info</link>
	<description>Trying to find useful things to do with emerging technologies in open education</description>
	<lastBuildDate>Sat, 18 May 2013 08:40:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.ouseful.info' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>OUseful.Info, the blog... &#187; More Shiny Goodness &#8211; Tinkering With the Ergast Motor Racing Data API</title>
		<link>http://blog.ouseful.info</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.ouseful.info/osd.xml" title="OUseful.Info, the blog..." />
	<atom:link rel='hub' href='http://blog.ouseful.info/?pushpress=hub'/>
		<item>
		<title>More Shiny Goodness &#8211; Tinkering With the Ergast Motor Racing Data API</title>
		<link>http://blog.ouseful.info/2012/12/04/more-shiny-goodness-tinkering-with-the-ergast-motor-racing-data-api/</link>
		<comments>http://blog.ouseful.info/2012/12/04/more-shiny-goodness-tinkering-with-the-ergast-motor-racing-data-api/#comments</comments>
		<pubDate>Tue, 04 Dec 2012 14:14:40 +0000</pubDate>
		<dc:creator>Tony Hirst</dc:creator>
				<category><![CDATA[Rstats]]></category>
		<category><![CDATA[Tinkering]]></category>
		<category><![CDATA[ergastAPI]]></category>
		<category><![CDATA[f1datajunkie]]></category>
		<category><![CDATA[Rstudio]]></category>
		<category><![CDATA[Shiny]]></category>

		<guid isPermaLink="false">http://blog.ouseful.info/?p=9230</guid>
		<description><![CDATA[I had a bit of a play with Shiny over the weekend, using the Ergast Motor Racing Data API and the magical Shiny library for R, that makes building interactive, browser based applications around R a breeze. As this is just a quick heads-up/review post, I&#8217;ll largely limit myself to a few screenshots. When I [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.ouseful.info&#038;blog=325417&#038;post=9230&#038;subd=ouseful&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I had a bit of a play with Shiny over the weekend, using the <a href="http://ergast.com/mrd/">Ergast Motor Racing Data API</a> and the magical <a href="http://www.rstudio.com/shiny/">Shiny library for R</a>, that makes building interactive, browser based applications around R a breeze.</p>
<p>As this is just a quick heads-up/review post, I&#8217;ll largely limit myself to a few screenshots. When I get a chance, I&#8217;ll try to do a bit more of a write-up, though this may actually just take the form of more elaborate documentation of the app, both within the code and in the form of explanatory text in the app itself.</p>
<p>If you want to try ou the app, you can find an instance here: <a href="http://glimmer.rstudio.com/psychemedia/f1ergastdemo">F1 2012 Laptime Explorer</a>. The <a href="https://gist.github.com/4188912">code is also available</a>.</p>
<p>Here&#8217;s the initial view &#8211; the frist race of the season is selected as a default and data loaded in. The driver list is for all drivers represented during the season.</p>
<p><img src="http://ouseful.files.wordpress.com/2012/12/f1-2012-shiny-ergast-explorer.png?w=700&#038;h=404" alt="f1 2012 shiny ergast explorer" width="700" height="404" class="alignnone size-full wp-image-9254" /></p>
<p>THe driver selectors allow us to just display traces for selected drivers.</p>
<p>The <em>Race History chart</em> is a classic results chart. It show the difference between the race time to date for each driver, by lap, compared to the average lap time for the winner times the lap number. (As such, this is an offline statistic &#8211; it is calculated when the winner&#8217;s overall average laptime is known).</p>
<p><img src="http://ouseful.files.wordpress.com/2012/12/race-hisotry-classic-chart.png?w=700&#038;h=350" alt="race hisotry - classic chart" width="700" height="350" class="alignnone size-full wp-image-9253" /></p>
<p>Variants of the classic Race History chart are possible, for example, using different base line times, but I haven&#8217;t implemented any of them  &#8211; or the necessary UI controls. Yet&#8230;</p>
<p>The <em>Lap Chart</em> is another classic:</p>
<p><img src="http://ouseful.files.wordpress.com/2012/12/lap-chart-another-classic.png?w=700&#038;h=356" alt="Lap chart - another classic" width="700" height="356" class="alignnone size-full wp-image-9252" /></p>
<p>Annotations for this chart are also supported, describing all drivers who final status was not &#8220;Finished&#8221;.</p>
<p><img src="http://ouseful.files.wordpress.com/2012/12/lap-chart-with-annotations.png?w=700&#038;h=344" alt="lap chart with annotations" width="700" height="344" class="alignnone size-full wp-image-9251" /></p>
<p>The <em>Lap Evolution chart</em> shows how each driver&#8217;s laptime evolved over the course of the race compared with the fastest overall recorded laptime.</p>
<p><img src="http://ouseful.files.wordpress.com/2012/12/lap-evolution.png?w=700&#038;h=348" alt="Lap evolution" width="700" height="348" class="alignnone size-full wp-image-9250" /></p>
<p>The <em>Personal Lap Evolution</em> chart shows how each driver&#8217;s laptime evolved over the course of the race compared with their personal fastest laptime.</p>
<p><img src="http://ouseful.files.wordpress.com/2012/12/personal-lap-evolution.png?w=700&#038;h=349" alt="Personal lap evolution" width="700" height="349" class="alignnone size-full wp-image-9249" /></p>
<p>The <em>Personal Deltas Chart</em> shows the difference between one laptime and the next for each driver.</p>
<p><img src="http://ouseful.files.wordpress.com/2012/12/personal-deltas.png?w=700&#038;h=366" alt="Personal deltas" width="700" height="366" class="alignnone size-full wp-image-9248" /></p>
<p>The <em>Race Summary Chart</em> is a chart of my own design that tries to capture notable features relating to race position &#8211; the grid position (blue circle), final classification (red circle), position at the end of the first lap (the + or horizontal bar). The violin plot shows the distribution of how many laps the driver spent in each race position. Where the chart is wide, the driver spent a large number of laps in that position.</p>
<p><img src="http://ouseful.files.wordpress.com/2012/12/race-summary.png?w=700&#038;h=422" alt="race summary" width="700" height="422" class="alignnone size-full wp-image-9247" /></p>
<p>The x-axis ordering pulls out different features about how the race progressed. I need to add in a control that lets the user select different orderings.</p>
<p>Finally, the <em>Fast Lap text scatterplot</em> shows the fastest laptime for each driver and the lap at which they recorded it.</p>
<p><img src="http://ouseful.files.wordpress.com/2012/12/fastlaps.png?w=700&#038;h=357" alt="fastlaps" width="700" height="357" class="alignnone size-full wp-image-9246" /></p>
<p>So &#8211; that&#8217;s a quick review of the app. All in all it took maybe 3 hours getting my head round the data parsing, 2-3 hours figuring what I wanted to do and learning how to do it in Shiny, and a couple of hours doing it/starting to document/annotate it. Next time, it&#8217;ll be much quicker&#8230;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ouseful.wordpress.com/9230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ouseful.wordpress.com/9230/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.ouseful.info&#038;blog=325417&#038;post=9230&#038;subd=ouseful&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.ouseful.info/2012/12/04/more-shiny-goodness-tinkering-with-the-ergast-motor-racing-data-api/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/abbd9f90565ce9ae4d065d93a81d8c03?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">Tony Hirst</media:title>
		</media:content>

		<media:content url="http://ouseful.files.wordpress.com/2012/12/f1-2012-shiny-ergast-explorer.png" medium="image">
			<media:title type="html">f1 2012 shiny ergast explorer</media:title>
		</media:content>

		<media:content url="http://ouseful.files.wordpress.com/2012/12/race-hisotry-classic-chart.png" medium="image">
			<media:title type="html">race hisotry - classic chart</media:title>
		</media:content>

		<media:content url="http://ouseful.files.wordpress.com/2012/12/lap-chart-another-classic.png" medium="image">
			<media:title type="html">Lap chart - another classic</media:title>
		</media:content>

		<media:content url="http://ouseful.files.wordpress.com/2012/12/lap-chart-with-annotations.png" medium="image">
			<media:title type="html">lap chart with annotations</media:title>
		</media:content>

		<media:content url="http://ouseful.files.wordpress.com/2012/12/lap-evolution.png" medium="image">
			<media:title type="html">Lap evolution</media:title>
		</media:content>

		<media:content url="http://ouseful.files.wordpress.com/2012/12/personal-lap-evolution.png" medium="image">
			<media:title type="html">Personal lap evolution</media:title>
		</media:content>

		<media:content url="http://ouseful.files.wordpress.com/2012/12/personal-deltas.png" medium="image">
			<media:title type="html">Personal deltas</media:title>
		</media:content>

		<media:content url="http://ouseful.files.wordpress.com/2012/12/race-summary.png" medium="image">
			<media:title type="html">race summary</media:title>
		</media:content>

		<media:content url="http://ouseful.files.wordpress.com/2012/12/fastlaps.png" medium="image">
			<media:title type="html">fastlaps</media:title>
		</media:content>
	</item>
	</channel>
</rss>
