<?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>Spatial.ly</title>
	<atom:link href="http://spatial.ly/feed/" rel="self" type="application/rss+xml" />
	<link>http://spatial.ly</link>
	<description>Spatial Analysis, Visualisation and Resources</description>
	<lastBuildDate>Wed, 15 May 2013 14:13:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Subway Maps and Visualising Social Equality</title>
		<link>http://spatial.ly/2013/05/subway-maps-social-equality/</link>
		<comments>http://spatial.ly/2013/05/subway-maps-social-equality/#comments</comments>
		<pubDate>Wed, 15 May 2013 11:30:07 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[Visualisation]]></category>
		<category><![CDATA[deprivation]]></category>
		<category><![CDATA[lives on the line]]></category>
		<category><![CDATA[new yorker]]></category>
		<category><![CDATA[social equality]]></category>
		<category><![CDATA[Tube map]]></category>

		<guid isPermaLink="false">http://spatial.ly/?p=4536</guid>
		<description><![CDATA[Most government statistics are mapped according to offi [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://life.mappinglondon.co.uk/"><img alt="tube_life" src="http://mappinglondon.co.uk/wp-content/uploads/2012/10/tube_life.png" width="906" height="498" /></a></p>
<p>Most government statistics are mapped according to official geographical units. Whilst such units are essential for data analysis and making decisions about, for example, government spending, they are hard for many people to relate to and they don’t particularly stand out on a map. This is why I tried a new method back in July 2012 to show life expectancy statistics in a fresh light by mapping them on to London Tube stations. The resulting ”<a href="http://life.mappinglondon.co.uk/" target="_blank">Lives on the Line</a>” map has been really popular with many people surprised at the extent of the variations in the data across London and also grateful for the way that it makes seemingly abstract statistics more easily accessible. To find out how I did it (and read some of the feedback) you can see <a href="http://spatialanalysis.co.uk/2012/07/lives-on-the-line/" target="_blank">here</a>.</p>
<p>About the same time <a href="http://www.sheffield.ac.uk/geography/students/pg/markgreen" target="_blank">Mark Green</a>, a PhD student from the University of Sheffield, had a similar idea to map levels of deprivation in London using an adaptation of Beck’s design. This map may be more familiar to people  than the geographically accurate version we used for <a href="http://life.mappinglondon.co.uk/" target="_blank">Lives on the Line</a>, and by using the size of the station circles you can see the extent to which levels of deprivation in London vary as you move along each line. Mark hasn’t managed to squeeze on any station labels so you may need to compare the map to the <a href="http://www.tfl.gov.uk/assets/downloads/standard-tube-map.pdf" target="_blank">real thing </a>to get a better idea of what’s going on. Mark’s map nicely illustrates some of the differences between inner and outer London (bigger circles are more deprived areas)  and also, to some extent, differences between east and west. To read more about the map <a href="http://www.ingentaconnect.com/content/maney/caj/2012/00000049/00000003/art00006" target="_blank">see here</a> (££).</p>
<p>Here is a small section of Mark’s map (I can&#8217;t show a better version as TfL will be unhappy):</p>
<p><a href="http://mappinglondon.co.uk/wp-content/uploads/2012/10/sheffield_londondepmap.png"><img title="sheffield_londondepmap" alt="" src="http://mappinglondon.co.uk/wp-content/uploads/2012/10/sheffield_londondepmap-247x300.png" width="247" height="300" /></a></p>
<p>In the past few months there have been a number of other visualisations of the variations in demographics along transport networks- mainly the London Tube. Danny Dorling&#8217;s <a href="http://astore.amazon.co.uk/spatialanalys-21/detail/1846145600" target="_blank">latest book</a> that walks readers along the 32 stops of the Central Line in London, exploring the lifestyles of those along it as portrayed by population data.</p>
<p><a href="http://astore.amazon.co.uk/spatialanalys-21/detail/1846145600"><img class="alignnone size-full wp-image-4556" alt="dorling_stops" src="http://spatial.ly/wp-content/uploads/2013/05/dorling_stops.png" width="314" height="513" /></a></p>
<p>&nbsp;</p>
<p>Although they aren&#8217;t quite maps, <a href="http://www.rentonomy.com/">Rentonomy</a> have produced graphs that show the average rents along each of the London Underground Lines. Whilst the information on these graphs is a fairly simplistic representation of some fairly complex patterns on the ground they are a quick and easy way of getting a rough idea of the sorts of places you can afford to rent in London.<a href="http://www.rentonomy.com/posts/98"><img class="alignnone size-full wp-image-4557" alt="rentonomy_district" src="http://spatial.ly/wp-content/uploads/2013/05/rentonomy_district.png" width="686" height="450" /></a></p>
<p>Taking inspiration (I assume!) from what we have been doing for London, the New Yorker has done an interactive graphic showing &#8220;<a href="http://www.newyorker.com/sandbox/business/subway.html" target="_blank">Inequality and New York&#8217;s Subway</a>&#8220;. <a href="http://www.newyorker.com/sandbox/business/subway.html"><img class="alignnone size-full wp-image-4558" alt="new_yorker" src="http://spatial.ly/wp-content/uploads/2013/05/new_yorker.png" width="911" height="683" /></a></p>
<p>It would have been nice to see the values on the map, nonetheless the graphic has proved extremely popular and may prompt some more in North America. The power of subway maps lies in the ways that people can easily relate to them, and so I think they offer a great tool for showing the headlines of social (in)equality in our cities.</p>
<p>A lot of the above has been x-posted from <a href="http://mappinglondon.co.uk/2012/the-tube-map-a-tool-for-promoting-social-equality/">mappinglondon. </a></p>
<p>And finally&#8230;thanks to <a href="https://twitter.com/muziejus">Moacir</a> for alerting me <a href="http://moacir.com/donkeyhottie/2013/04/17/cta-and-median-incomes/" target="_blank">to his version</a> based on median income along the Chicago Subway:<br />
<script type="text/javascript" src="http://public.tableausoftware.com/javascripts/api/viz_v1.js"></script></p>
<div class="tableauPlaceholder" style="width: 584px; height: 612px;">
<noscript><a href="#"><img alt=" " src="http:&#47;&#47;public.tableausoftware.com&#47;static&#47;images&#47;WR&#47;WR9T5DDH2&#47;1_rss.png" style="border: none" /></a></noscript>
<p>&nbsp;</p>

<!-- iframe plugin v.2.6 wordpress.org/extend/plugins/iframe/ -->
<iframe height="100%" width="100%" src="http://public.tableausoftware.com/shared/WR9T5DDH2?:toolbar=no&amp;:display_count=no" scrolling="no" class="iframe-class" frameborder="0"></iframe></div>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://spatial.ly/2013/05/subway-maps-social-equality/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Art of Data Visualisation Video</title>
		<link>http://spatial.ly/2013/05/art-data-visualisation-video/</link>
		<comments>http://spatial.ly/2013/05/art-data-visualisation-video/#comments</comments>
		<pubDate>Mon, 13 May 2013 12:03:35 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Video]]></category>
		<category><![CDATA[Visualisation]]></category>
		<category><![CDATA[art]]></category>
		<category><![CDATA[dataviz]]></category>
		<category><![CDATA[pbs]]></category>

		<guid isPermaLink="false">http://spatial.ly/?p=4546</guid>
		<description><![CDATA[Map design and cartography are now, more than ever, see [...]]]></description>
				<content:encoded><![CDATA[<p><iframe width="500" height="281" src="http://www.youtube.com/embed/AdSZJzb-aX8?feature=oembed" frameborder="0" allowfullscreen></iframe></p>
<p>Map design and cartography are now, more than ever, seen as just one set of tools in a growing data visualisation arsenal. This video features well-known data visualisers who talk through some of their guiding principles, offering many insights for those working with geographic data.</p>
<p>(via <a href="http://www.visualisingdata.com/index.php/2013/05/video-the-art-of-data-visualization/" target="_blank">Visualising Data</a>)</p>
]]></content:encoded>
			<wfw:commentRss>http://spatial.ly/2013/05/art-data-visualisation-video/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>3D Mapping in R</title>
		<link>http://spatial.ly/2013/05/3d-mapping-r/</link>
		<comments>http://spatial.ly/2013/05/3d-mapping-r/#comments</comments>
		<pubDate>Wed, 08 May 2013 14:33:34 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[R Spatial]]></category>
		<category><![CDATA[Resources]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[mapping]]></category>
		<category><![CDATA[R]]></category>

		<guid isPermaLink="false">http://spatial.ly/?p=4485</guid>
		<description><![CDATA[This tutorial has been kindly contributed by Robin Edwa [...]]]></description>
				<content:encoded><![CDATA[<section>
<section>
<section>This tutorial has been kindly contributed by<a href="http://geotheory.co.uk/" target="_blank"> Robin Edwards </a>(from UCL CASA).</section>
</section>
</section>
<div>
<p><a style="font-size: 13px;" href="http://cran.r-project.org/web/packages/rgl/rgl.pdf" target="_blank">RGL</a><span style="font-size: 13px;"> is R’s box of power-tool for 3D object rendering, with functionality for creating 3d mesh objects and curved surfaces, and for using materials and directional lighting.  For example the line:</span></p>
<pre>plot3d(rnorm(100),rnorm(100),rnorm(100))</pre>
<p>creates a 3d scatterplot of x-y-z normal distributions, producing:</p>
<p><a href="http://spatial.ly/wp-content/uploads/2013/05/rgl_basic_example.png"><img class="alignnone size-full wp-image-4488" alt="rgl_basic_example" src="http://spatial.ly/wp-content/uploads/2013/05/rgl_basic_example.png" width="606" height="562" /></a></p>
<p><a href="http://www.r-bloggers.com/the-openstreetmap-package-opens-up/" target="_blank">OpenStreetMap</a> provides a nice way to import map tiles via the OSM API (among others). A helpful StackOverLoader (<a href="http://stackoverflow.com/questions/16202558/plotting-3d-maps-with-rgl/16232865#16232865" target="_blank">Spacedman</a>) has provided this useful function for adding ‘z’ values to OSM map objects, enabling them to be plotted in 3d:</p>
<pre>map3d &lt;- function(map, ...){
  if(length(map$tiles)!=1){stop("multiple tiles not implemented") }
  nx = map$tiles[[1]]$xres
  ny = map$tiles[[1]]$yres
  xmin = map$tiles[[1]]$bbox$p1[1]
  xmax = map$tiles[[1]]$bbox$p2[1]
  ymin = map$tiles[[1]]$bbox$p1[2]
  ymax = map$tiles[[1]]$bbox$p2[2]
  xc = seq(xmin,xmax,len=ny)
  yc = seq(ymin,ymax,len=nx)
  colours = matrix(map$tiles[[1]]$colorData,ny,nx)
  m = matrix(0,ny,nx)
  surface3d(xc,yc,m,col=colours, ...)
}</pre>
<p>A benefit of the approach is that it enables you to adjust the map to the ideal perspective for representing the data in the final rendered image. Here I&#8217;ve applied the function to <a href="http://data.london.gov.uk/datastore/package/average-private-rents-borough" target="_blank">data on London&#8217;s rental costs</a> (for the year to December 2012), extruding thick lines for cost comparisons:</p>
<p><a href="http://spatial.ly/wp-content/uploads/2013/05/rgl_3d_map.jpg"><img class="alignnone size-full wp-image-4486" alt="rgl_3d_map" src="http://spatial.ly/wp-content/uploads/2013/05/rgl_3d_map.jpg" width="1919" height="847" /></a></p>
<p>The satellite version, simply replacing &#8216;osm&#8217; with &#8216;bing&#8217; in the code..<br />
<a href="http://spatial.ly/wp-content/uploads/2013/05/rgl_3d_satellite.jpg"><img class="alignnone size-full wp-image-4487" alt="rgl_3d_satellite" src="http://spatial.ly/wp-content/uploads/2013/05/rgl_3d_satellite.jpg" width="1849" height="603" /></a></p>
<p><a href="https://gist.github.com/geotheory/5469317" target="http://geotheory.co.uk/blog/wp-content/uploads/2013/04/rgl_3d_satellite.png">Code @ Github</a></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://spatial.ly/2013/05/3d-mapping-r/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Prof. Mike Batty Talks Big Data and Smart Cities</title>
		<link>http://spatial.ly/2013/05/prof-mike-batty-talks-big-data-smart-cities/</link>
		<comments>http://spatial.ly/2013/05/prof-mike-batty-talks-big-data-smart-cities/#comments</comments>
		<pubDate>Mon, 06 May 2013 16:34:24 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[Big data]]></category>
		<category><![CDATA[Mike Batty]]></category>
		<category><![CDATA[smart cities]]></category>

		<guid isPermaLink="false">http://spatial.ly/?p=4293</guid>
		<description><![CDATA[&#8220;Big Data&#8221; and &#8220;Smart Cities&#8221; a [...]]]></description>
				<content:encoded><![CDATA[<p><iframe src="http://player.vimeo.com/video/62000852" width="500" height="375" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></p>
<p>&#8220;Big Data&#8221; and &#8220;Smart Cities&#8221; are two concepts receiving a lot of attention at the moment. <a href="http://www.bartlett.ucl.ac.uk/casa" target="_blank">CASA</a>&#8216;s Director, Professor Mike Batty cuts through the hype to reveal some of the insights we can gain through the analysis and mining of large transportation datasets.</p>
]]></content:encoded>
			<wfw:commentRss>http://spatial.ly/2013/05/prof-mike-batty-talks-big-data-smart-cities/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Crash Course in R</title>
		<link>http://spatial.ly/2013/05/crash/</link>
		<comments>http://spatial.ly/2013/05/crash/#comments</comments>
		<pubDate>Wed, 01 May 2013 17:34:24 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[R Spatial]]></category>
		<category><![CDATA[Resources]]></category>
		<category><![CDATA[beginners]]></category>
		<category><![CDATA[crash course]]></category>
		<category><![CDATA[R]]></category>

		<guid isPermaLink="false">http://spatial.ly/?p=4479</guid>
		<description><![CDATA[This code has been kindly contributed by Robin Edwards  [...]]]></description>
				<content:encoded><![CDATA[<p>This code has been kindly contributed by<a href="http://geotheory.co.uk/" target="_blank"> Robin Edwards </a>(from UCL CASA).</p>
<p>There are many useful introductory guides out there to R, but below is the kind of thing I now wish I’d been given when I first started using it – something with simple logically-progressive examples and minimal explanatory text. Copy the text below into a new script in R and run line-by-line to give a quick intro to many of R’s most basic principles and functionality. You can also download a text file with it <a href="http://spatial.ly/wp-content/uploads/2013/05/r_crash_course.txt">here</a>. It is by no means comprehensive, even at the most basic level, but still I hope someone finds it useful. You may want to look at <a href="http://www.rstudio.com/" target="_blank">RStudio</a> as it is more user-friendly.<br />
<code><br />
## A CRASH COURSE IN [R] PROGRAMMING<br />
## Robin Edwards (geotheory.co.uk), March 2013<br />
## In RStudio run through line-by-line using Ctrl + Enter</code></p>
<p># basic R environmental functions<br />
x=3.14159; y=&#8217;hello world&#8217;; z=TRUE # create some objects. In RStudio they&#8217;ll appear in &#8216;Workspace&#8217;<br />
ls() # list the objects in the Workspace<br />
print(y) # print information to R &#8216;Console&#8217;<br />
rm(y) # remove an object<br />
rm(list=ls()) # remove all<br />
getwd() # find current working directory<br />
setwd(&#8220;/Users/robinedwards/Documents&#8221;) # set working directory as preferred<br />
print ( &#8220;R ignores the &#8216;white-space&#8217; in command syntax&#8221; )</p>
<p># use &#8216;?&#8217; for help on any R function (if its library is loaded in the session)<br />
?max<br />
??csv # search for a text string in R documentation library<br />
library(help=utils) # get help on a particular package (list its functions)</p>
<p># &#8216;str&#8217; is a powerful tool for investigating the underlying structure of any R object<br />
str(max)</p>
<p># CREATING AND MANIPULATING R OBJECTS</p>
<p># assigning values to variables<br />
n = 5 # is possible but<br />
n 5 -&gt; n<br />
rm(n)</p>
<p># R objects can be of various data types, but probably most common are &#8216;numeric&#8217; and &#8216;character&#8217;<br />
( num ( char &lt;- &#8216;any text string&#8217; )</p>
<p># create a VECTOR (array) using the &#8216;c()&#8217; concatenate function<br />
( vec</p>
<p># a vector series<br />
( vec</p>
<p># R vectors can be accessed in various ways using [ ] brackets<br />
vec[3]<br />
vec[3:6]<br />
vec[ c(1,3,8) ]<br />
vec[vec &gt; 15]</p>
<p># check a vector contains a value<br />
5 %in% vec<br />
12 %in% vec</p>
<p># finding first index position of a matching value/sting<br />
( x = c(&#8216;one&#8217;, &#8216;five&#8217;, &#8216;two&#8217;, 3, &#8216;two&#8217;) )<br />
match(&#8216;two&#8217;, x)<br />
match(c(&#8216;two&#8217;,'five&#8217;), x)</p>
<p># a MATRIX is a 2D vector (essentially a vector of vectors) of matching data type<br />
( matrx = matrix(1:15, 3, 5) )<br />
( matrx dim(matrx) print(matrx)<br />
t(matrx) # a matrix can be easily transposed</p>
<p># an ARRAY is a generic vector but with more flexibiity. A 1D array is the same as a normal vector,<br />
# and a 2D array is like a matrix. But arrays can store data with &#8216;n&#8217; dimensions:<br />
( arry</p>
<p># Using square brackets on arrays<br />
arry[12] # a single criterion (argument) selects the array&#8217;s n&#8217;th record<br />
arry[3,1,2] # or use multiple arguments that reflect the array&#8217;s dimensionality<br />
arry[,,2]<br />
arry[,1,]</p>
<p># a DATA.FRAME is like a matrix, but accomodates fields (columns) with different data types<br />
(df</p>
<p># They can be viewed easily<br />
View(df)</p>
<p># examine their internal stucture<br />
str(df)</p>
<p># data interrogation with square brackets<br />
df[1,]<br />
df[2:3,]<br />
df[,1]<br />
df[2,1]</p>
<p># data.frame and matrix objects can have field (column) and record (row) names<br />
dimnames(df)<br />
colnames(df)<br />
names(df) # not for matrix objects<br />
row.names(df)</p>
<p># interrogate data.frames by field name using the &#8216;$&#8217; operator. the result is a simple vector<br />
df$name<br />
df$name[2]</p>
<p># names can be reassigned<br />
names(df) row.names(df) print(df)</p>
<p># check dimensions of vector/matrix/array/data.frame objects<br />
length(vec)<br />
dim(df)<br />
dim(arry)<br />
nrow(df)<br />
ncol(df)</p>
<p># R has various inbuilt data.frame datasets used to illustrate how functions operate e.g.<br />
data()<br />
InsectSprays # this guide makes use of these datasets<br />
warpbreaks</p>
<p># examine contents<br />
head(InsectSprays) # list the top records of a vector / matrix / d.f.<br />
tail(InsectSprays, n=3) # bottom the 3<br />
summary(InsectSprays) # summarise a data vector</p>
<p># aggregate() is a powerful function for summarising categorical data<br />
aggregate(InsectSprays$count, by=list(InsectSprays$spray), FUN=mean)<br />
sumInsects names(sumInsects) print(sumInsects)</p>
<p># subset/apply filter to a data.frame<br />
warpbreaks[warpbreaks$wool=='A',] # by 1 condition<br />
warpbreaks[warpbreaks$tension %in% c('L','M'),] # multiple conditions</p>
<p># adding entries is possible (if a bit tricky)<br />
(newrow (warpbreaks</p>
<p># but LISTS are better at this<br />
lst = list()</p>
<p># ways to assign/add items<br />
lst[1] = &#8220;one&#8221;<br />
lst[[2]] &lt;- &#8220;two&#8221;<br />
lst[length(lst)+1] &lt;- &#8220;three&#8221;<br />
print(lst)</p>
<p># data retrieval<br />
lst[[1]] # double brackets means the object returned is of the data class of the list item<br />
lst[2:3] # selecting a more than 1 list item is possible with single brackets..<br />
lst[c(1,3)] # but the object returned (from single bracket interrogation) is a list</p>
<p># delete list items<br />
lst[[3]] lst[1:2] lst</p>
<p># entries can be any object type (like python), including other lists (double bracketting)<br />
lst[[1]] lst[[2]] &lt;- &#8216;item2&#8242;<br />
lst<br />
lst[[1]][[1]]</p>
<p># Data in lists can also be stored and recalled by key word/number (like Python&#8217;s dictionary class)<br />
dict dict['wed'] print(dict)<br />
dict[['tues']]<br />
dict[c('mon','wed')]</p>
<p># reorder a vector with &#8216;sort&#8217;<br />
vec sort(vec)</p>
<p># or a dataframe with &#8216;order&#8217;<br />
df[order(df$years),]</p>
<p># LOGICAL objects (booleans) are binary true/false objects that facilitate conditional data processing<br />
(bool (bool</p>
<p># query an object&#8217;s data/structure type with &#8216;class()&#8217;<br />
class(bool)<br />
class(num) # numeric is the default data type for number objects<br />
class(as.integer(num)) # integer class exists but is not default<br />
class(char) # character class<br />
class(&#8217;237&#8242; ) # numbers aren&#8217;t always numeric type<br />
as.numeric(&#8217;237&#8242;) # but can be converted<br />
as.character(237) # and vice verse</p>
<p># Child-objects are often of different class to parents<br />
class(df)<br />
class(df[,2])<br />
class(df[,1])</p>
<p># FACTOR objects are vectors of items that have been categorised by unique values<br />
factr str(factr)<br />
levels(factr)<br />
table(factr)</p>
<p># you may encounter problems converting a factor of numeric data to numeric type<br />
as.numeric(factr)</p>
<p># instead do this<br />
as.numeric(as.character(factr))</p>
<p># editing factors can be tricky<br />
print(df)<br />
df$person[1] &lt;- &#8216;Matthew&#8217;</p>
<p># instead convert to character or numeric etc<br />
df$person df$person[1] &lt;- &#8216;Matthew&#8217;<br />
df$person levels(df$person)</p>
<p># LOGICAL OPERATIONS<br />
2 + 2 == 4 # &#8216;==&#8217; denotes value equality<br />
3 &lt;= 2 # less than or equal to<br />
3 &gt;= 2 # greater than or equal to<br />
&#8216;string&#8217; == &#8220;string&#8221;<br />
&#8216;b&#8217; &gt;= &#8216;a&#8217; # strings can be ranked<br />
3 != 3 # NOT operator<br />
c(4,2,6) == c(4,2,8) # vector comparisons return locical vectors<br />
TRUE == T # &#8216;T&#8217; and &#8216;F&#8217; default as boolean shortcuts (until overwritten)<br />
TRUE &amp; TRUE # AND operator<br />
TRUE | FALSE # OR operator<br />
F | F</p>
<p># IF/ELSE statement (used in most logical procedures)<br />
x if(x &lt; 5){<br />
print(&#8216;x is less than 5&#8242;)<br />
} else{<br />
print(&#8216;x is not less than 5&#8242;)<br />
}</p>
<p>if(T|F) print(&#8216;single liners can dispense with curly brackets&#8217;)<br />
if(T&amp;F) print(&#8221;) else print(&#8220;but then &#8216;else&#8217; only works on the same line&#8221;)</p>
<p># LOOPING FUNCTIONS &#8211; very useful for handling repetitive operations</p>
<p># &#8216;FOR&#8217; loop<br />
for(i in 1:10){<br />
print(paste(&#8216;number &#8216;,i))<br />
}</p>
<p># WHILE loop (be careful to include safeguards to prevent infinite loops)<br />
i = 30<br />
while(i &gt; 0){<br />
print(paste(&#8216;number &#8216;,i))<br />
i = i &#8211; 3<br />
}</p>
<p># creating a function<br />
multiply tot return(tot)<br />
}</p>
<p>multiply(3,5)<br />
# note &#8216;tot&#8217; wasn&#8217;t remembered outside the function &#8211; functions are contained environments<br />
# if required use &#8216;&lt;&lt;-&#8217; for global assignment but be careful not to overwrite R&#8217;s internal objects<br />
# its generally better to do this:<br />
newVar</p>
<p># handling &#8216;NA&#8217; values<br />
(x = 1:5)<br />
x[8] = 8<br />
x[3] = NA<br />
print(x) # sometimes functions will fail because of NA values<br />
na.omit(x) # iterates full list but ignores NAs<br />
x[na.omit(x)]<br />
is.na(x) # alternatively<br />
x[!is.na(x)]</p>
<p># useful basic math functions<br />
seq(-2, 2, by=.2) # sequence of equal difference<br />
seq(length=10, from=-5, by=.2) # with range defined by vector length<br />
rnorm(20, mean = 0, sd = 1) # random normal distribution<br />
runif(20, min=0, max=100) # array of random numbers<br />
sample(0:100, 20, replace=TRUE) # array of random integers<br />
table(warpbreaks[,2:3]) # array summary stats (powerful summary tool)<br />
min(vec)<br />
max(vec)<br />
range(vec)<br />
mean(vec)<br />
median(vec)<br />
sum(vec)<br />
prod(vec)<br />
abs(-5) # magnitude<br />
sd(rnorm(10)) # standard deviation<br />
4^2 # square<br />
sqrt(16) # square root<br />
5%%3 # modulo (remainder after subtraction of any multiple)<br />
6%%2<br />
for(i in 1:100) if(i%%20==0) print(i) # useful for running an operation every n&#8217;th cycle</p>
<p># Importing and exporting data using comma-separated file<br />
write.csv(df, &#8216;example.csv&#8217;) # save to csv file<br />
rm(df)<br />
(df</p>
<p># PLOTTING IN R</p>
<p># some basic functionality<br />
plot(1:10)<br />
plot(sort(rnorm(100)), pch=16, cex=0.5) # specifying point and size respectively<br />
plot(x=1:25, y=25:1, pch=1:25) # x &amp; y inputs, and showing the available point symbols<br />
plot(sin, -pi, 2*pi)<br />
hist(rnorm(1000), breaks=50)<br />
barplot(sumInsects$sum, names.arg = sumInsects$group)<br />
pie(sumInsects$sum, labels = sumInsects$group)</p>
<p># plots with more visual components are built up incrementally<br />
x plot(x, pch=17)<br />
lines(x, col=&#8217;#00FF00&#8242;)<br />
points(x+5, pch=16, col=&#8217;red&#8217;)</p>
<p># stacking charts<br />
warpbreaks<br />
sumWB names(sumWB) sumWB<br />
(data barplot(data, names.arg=c(&#8216;Group A&#8217;,'Group B&#8217;),<br />
legend.text=c(&#8216;L&#8217;,'M&#8217;,'H&#8217;), args.legend = list(x = &#8220;right&#8221;))</p>
<p>barplot(data, names.arg=c(&#8216;Group A&#8217;,'Group B&#8217;), beside=T,<br />
legend.text=c(&#8216;L&#8217;,'M&#8217;,'H&#8217;), args.legend = list(x = &#8220;topright&#8221;))</p>
<p># &#8216;symbols()&#8217; is a good way to represent a 3rd data dimension (use square root for area proportionality)<br />
(cities lon=c(-0.1,-2.6,-2.2,-1.5), lat=c(51.5,51.4,53.5,53.8), pop=c(8,1,2.7,0.8)))<br />
symbols(x=cities$lon, y=cities$lat, circles=sqrt(cities$pop), inches=0.3,<br />
bg=&#8217;red&#8217;, fg=NULL, asp=T, xlab=&#8217;Longitude&#8217;, ylab=&#8217;Latitude&#8217;)<br />
abline(h=(seq(51,53,1)), col=&#8221;lightgray&#8221;, lty=1)<br />
abline(v=(seq(-4,1,1)), col=&#8221;lightgray&#8221;, lty=1)<br />
text(x=cities$lon, y=cities$lat+0.2, labels=cities$city)</p>
<p># But for much easier and more elegant data visualisation use GGPLOT2</p>
<p># END OF SCRIPT</p>
]]></content:encoded>
			<wfw:commentRss>http://spatial.ly/2013/05/crash/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Visualising for Human Geography</title>
		<link>http://spatial.ly/2013/05/visualising-human-geography/</link>
		<comments>http://spatial.ly/2013/05/visualising-human-geography/#comments</comments>
		<pubDate>Wed, 01 May 2013 14:25:54 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[Slideshow]]></category>
		<category><![CDATA[Spatial Analysis]]></category>
		<category><![CDATA[Visualisation]]></category>
		<category><![CDATA[benchmarking review]]></category>
		<category><![CDATA[GIS]]></category>
		<category><![CDATA[human geography]]></category>

		<guid isPermaLink="false">http://spatialanalysis.co.uk/?p=4064</guid>
		<description><![CDATA[The publication of the International Benchmarking Revie [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/walkingsf/sets/72157624209158632/"><img class="alignnone size-full wp-image-4432" title="Locals Vs Tourists by Eric Fischer" alt="Locals Vs Tourists by Eric Fischer" src="http://spatial.ly/wp-content/uploads/2013/04/locals_v_tourists_med.jpg" width="640" height="640" /></a></p>
<p>The publication of the<a href="http://www.esrc.ac.uk/_images/Human-Geography-Benchmarking-Review-Report_tcm8-25257.pdf" target="_blank"> Inte</a><a href="http://www.esrc.ac.uk/_images/Human-Geography-Benchmarking-Review-Report_tcm8-25257.pdf" target="_blank">rnational Benchmarking Review of UK Human Geography</a> back in March was a major event for the discipline. The report concludes that the UK human geography community is setting the intellectual agenda for the subject and can therefore consider itself the best in the world. Whilst this is a great achievement, the &#8220;relative weakness in quantitative methods and GIS&#8221; (p16) was also highlighted. The authors flag the growing interest in data visualisation, and its value for information dissemination and impact, but suggest that human geographers may not be ahead of the curve in the same way as they are in other parts of the discipline.</p>
<p>Compelling data visualisation is the key to communicating results from research widely and, perhaps most importantly, a means to inspire current and future students to work with quantitative data. More maps (and other visualisations) than ever are being produced, but many are methodologically flawed or misleading because the people who created them are great with complex software and data manipulation, but less good at placing their visual outputs in context. I would argue that human geographers, with their knowledge of population processes, are uniquely placed to perform a &#8220;<a href="http://en.wikipedia.org/wiki/Sanity_testing" target="_blank">sanity check</a>&#8221; on the many graphics that stem from analysis that has set off down the wrong path. Human geographers are also well-aware of the power of maps to change perceptions of the world (both for the better or worse) so they are perhaps a little more cautious in the way they portray data and make doubly sure that they have produced something that is both representative and defensible.</p>
<p>So, it is more important than ever for geographers to engage with the many relevant datasets that are now available and also with the communities (largely of computer scientists and designers) that are currently grappling with them. We don&#8217;t all have the skills to manipulate large datasets, or visualise them, but we can still contribute to the creative process and ensure the outcomes are representative of the data used to produce them. The benchmarking review lists four people/ groups that have made a start in this regard [Hans Rosling (of GapMinder), Simon Rogers (formerly, the Guardian), Danny Dorling (and colleagues) and CASA (where I work)]. Interestingly only two would probably badge themselves as geographers.  I thought I&#8217;d speculate a little about what makes each of these groups successful in this context and also add a few more groups that I think could offer the inspiration needed to get more people visualising human geography.</p>
<h1>Hans Rosling and Gapminder</h1>
<p><iframe width="500" height="281" src="http://www.youtube.com/embed/jbkSRLYSojo?feature=oembed" frameborder="0" allowfullscreen></iframe></p>
<p><a href="http://www.gapminder.org/" target="_blank">Gapminder</a> helped to kick-start the interest in the power of data visualisation to explore the complexities of global development. The website, and energetic videos by Hans Rosling, have raised the profile of the many datasets compiled by global organisations, such as the UN, and offer a means for students to engage with data in an interesting way. For people starting to think about data, Gapminder should be one of the first websites they visit.</p>
<h1>Simon Rogers &amp; the Guardian Data Store</h1>
<p><a href="http://www.guardian.co.uk/data"><img class="alignnone size-full wp-image-4434" alt="Guardian Datastore" src="http://spatial.ly/wp-content/uploads/2013/04/datastore.png" width="642" height="833" /></a></p>
<p>The <a href="http://www.guardian.co.uk/data" target="_blank">Guardian Data Store</a> and its associated blog have raised the profile of human geographers in the UK more than any other website over the past couple of years. Simon Rogers and his team have actively sought visualisations to feature (including many from this blog) and this has often resulted in interest from a range of other media outlets. Some of the graphics featured have been a bit dubious, but there has always been scope to comment and the team have taken criticisms on board. This has facilitated an important dialogue that is a great success story in terms of academic/ media engagement. The blog and the push for freely available data has been a great force for good and as Simon moves on to Twitter, I hope it will continue to promote the work of geographers.</p>
<h1>Danny Dorling and Worldmapper</h1>
<p><a href="http://www.worldmapper.org/"><img class="alignnone size-full wp-image-4435" alt="worldmapper" src="http://spatial.ly/wp-content/uploads/2013/04/worldmapper.png" width="1123" height="766" /></a></p>
<p>I think the work of Danny Dorling and his team at the University of Sheffield is notable for two reasons. The first is their promotion of cartograms. <a href="http://spatial.ly/2009/10/cartograms/">Cartograms</a> distort the world according to a particular variable (in the map above it&#8217;s population) so that areas with the highest values become larger at the expense of areas with smaller values. The impact of this approach is the way that it draws attention to the places on the map that matter. This slightly trippy cartography is also a powerful way of changing perceptions of the world (so <a href="http://spatial.ly/2011/03/flattening-the-earth/">often based</a> on the Mercator projection) and can form the basis for discussions about representations of geographic data.</p>
<p>Secondly, Danny has done a huge amount to promote spatial equity by making population data accessible to a wider audience. At the moment I am reading his<a href="http://astore.amazon.co.uk/spatialanalys-21/detail/1846145600" target="_blank"> latest book</a> that walks readers along the 32 stops of the Central Line in London (a similar idea to <a href="http://spatial.ly/2012/07/lives-on-the-line/" target="_blank">the map I </a><a href="http://spatial.ly/2012/07/lives-on-the-line/" target="_blank">produced last year</a>), exploring the lifestyles of those along it as portrayed by population data. Such data are used everyday by government and industry to alter people&#8217;s lives, but many are unaware about what it says about them and also how it can be used to promote equality. This kind of work is controversial at times but forms an important component of the informed social debates that human geographers can contribute to through good data visualisation.</p>
<h1>The UCL Centre for Advanced Spatial Analysis (CASA)</h1>
<p><a href="http://mappinglondon.co.uk/2012/travel-to-work/"><img class="alignnone size-full wp-image-4436" title="Commuter Flows, Duncan Smith" alt="duncan_smith_commuter_flows" src="http://spatial.ly/wp-content/uploads/2013/04/duncan_smith_commuter_flows.jpg" width="1087" height="693" /></a></p>
<p>At <a href="http://www.bartlett.ucl.ac.uk/casa" target="_blank">CASA</a> we have produced a fair number of visualisations (many I have featured on this blog).  Most of what we do requires a collaboration between geographers, computer scientists and others to collect the data, format it and visualise it. We are lucky to have such a rich mix of disciplines in the department and I think it represents a successful template for geography departments more broadly as the need for quantitative methods increases with data volumes. <a href="http://www.bartlett.ucl.ac.uk/casa/programmes/postgraduate/mres-advanced-spatial-analysis-visualisation">We also run a great masters course&#8230;</a></p>
<h1>Floatingsheep</h1>
<p><a href="http://www.floatingsheep.org/"><img class="alignnone size-full wp-image-4437" alt="floatingsheep_guns" src="http://spatial.ly/wp-content/uploads/2013/04/floatingsheep_guns.jpg" width="1056" height="816" /></a></p>
<p>Despite their slightly baaamy (see what I did there) name, the team behind <a href="http://www.floatingsheep.org/" target="_blank">floatingsheep</a> are seriously getting to grips with the new forms of data produced online. With maps entitled &#8220;<a href="http://www.floatingsheep.org/2010/02/beer-belly-of-america.html" target="_blank">The Beer Belly of America</a>&#8221; and &#8220;<a href="http://www.floatingsheep.org/2011/08/price-of-weed.html" target="_blank">The Price of Weed</a>&#8220;, students will be instantly engaged. There is also a long list of <a href="http://www.floatingsheep.org/p/publications.html" target="_blank">academic publications</a> available that explore the more substantive research questions associated with the geography of the internet.</p>
<h1><span style="font-size: 13px;"> </span>New York Times Graphics Department</h1>
<p><a href="http://spatial.ly/wp-content/uploads/2012/03/ny_times_election.jpg"><img class="alignnone size-full wp-image-3513" alt="ny_times_election" src="http://spatial.ly/wp-content/uploads/2012/03/ny_times_election.jpg" width="1835" height="1460" /></a></p>
<p><a href="https://twitter.com/nytgraphics" target="_blank">The New York Times Graphics Department </a>excel at high quality data visualisation that is eye catching and informative. The graphic above speaks for itself.</p>
<h1>Stamen</h1>
<p><a href="http://www.stamen.com/"><img class="alignnone size-full wp-image-4461" alt="stamen_london" src="http://spatial.ly/wp-content/uploads/2013/04/stamen_london.gif" width="1250" height="637" /></a></p>
<p><a href="http://www.stamen.com/" target="_blank">Stamen Design</a> have produced a series of interactive visualisations from a range of datasets that have consistently raised the bar in terms of what is possible for geographic data. If you are creating anything interactive and online, their base maps are especially useful as they enhance the appearance of the data overlaid on top of them.  There is no longer any reason to use the default Google cartography!</p>
<h1>Eric Fischer</h1>
<p><a href="http://spatial.ly/wp-content/uploads/2011/12/twitter_language.jpg"><img class="alignnone size-full wp-image-3278" alt="twitter_language" src="http://spatial.ly/wp-content/uploads/2011/12/twitter_language.jpg" width="1024" height="722" /></a></p>
<p><a href="https://twitter.com/enf" target="_blank">Eric Fischer </a>has led the way in producing stunning visualisations from social media data. Social media datasets, especially from Twitter, are creating a lot of hype at the moment in quantitive human geography and no-one maps them better than Eric.</p>
<h1>Nathan Yau of Flowing Data</h1>
<p><a href="http://flowingdata.com/"><img class="alignnone size-full wp-image-4463" alt="flowing_data_im" src="http://spatial.ly/wp-content/uploads/2013/04/flowing_data_im.jpg" width="675" height="803" /></a></p>
<p>Finally, Nathan Yau&#8217;s<a href="http://flowingdata.com/" target="_blank"> flowingdata</a> frequently features excellent examples data visualisation with geographic data. The blog has a huge range of examples and a number of tutorials that would be of benefit to human geographers, especially when teaching.</p>
]]></content:encoded>
			<wfw:commentRss>http://spatial.ly/2013/05/visualising-human-geography/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Twitter Languages in the Guardian</title>
		<link>http://spatial.ly/2013/04/twitter-languages-guardian/</link>
		<comments>http://spatial.ly/2013/04/twitter-languages-guardian/#comments</comments>
		<pubDate>Fri, 26 Apr 2013 17:13:56 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Media]]></category>

		<guid isPermaLink="false">http://spatial.ly/?p=4247</guid>
		<description><![CDATA[An updated version of the London Twitter Languages map  [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://spatial.ly/wp-content/uploads/2013/04/guardian_spread_sml.png"><img class="alignnone size-full wp-image-4250" alt="guardian_spread_sml" src="http://spatial.ly/wp-content/uploads/2013/04/guardian_spread_sml.png" width="1243" height="693" /></a></p>
<p>An updated version of the London Twitter Languages map I produced with <a href="http://urbanmovements.co.uk/">Ed Manley</a> recently appeared as a double page spread in the Guardian. The colour scheme is different to the original and we use a far larger dataset collected by John Barratt of <a href="http://trendsmap.com/">Trendsmap</a>. We want to keep this one print-only for the time being so we are keeping it offline.</p>
]]></content:encoded>
			<wfw:commentRss>http://spatial.ly/2013/04/twitter-languages-guardian/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Starting Analysis and Visualisation of Spatial Data with R</title>
		<link>http://spatial.ly/2013/04/analysis-visualisation-spatial-data/</link>
		<comments>http://spatial.ly/2013/04/analysis-visualisation-spatial-data/#comments</comments>
		<pubDate>Mon, 08 Apr 2013 08:57:23 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[R Spatial]]></category>
		<category><![CDATA[Resources]]></category>
		<category><![CDATA[Spatial Analysis]]></category>
		<category><![CDATA[dataviz]]></category>
		<category><![CDATA[ggplot2]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[rstats]]></category>
		<category><![CDATA[spatial data]]></category>
		<category><![CDATA[Visualisation]]></category>

		<guid isPermaLink="false">http://spatialanalysis.co.uk/?p=4038</guid>
		<description><![CDATA[Last week I ran an introductory workshop on the analysi [...]]]></description>
				<content:encoded><![CDATA[<p>Last week I ran an introductory workshop on the analysis and visualisation of spatial data with <a href="http://www.r-project.org/" target="_blank">R</a>. The software has become established as one of the best around for statistics and it is becoming increasingly recognised as a tool for data visualisation (I wrote about this <a href="http://spatialanalysis.co.uk/2012/01/coming-age-spatial-data-visualisation/" target="_blank">last year</a>, also <a href="http://www.netmagazine.com/features/top-20-data-visualisation-tools" target="_blank">see here</a>) and spatial analysis. Interest in R is increasing all the time but many feel put off by its very steep learning curve. The help files are often complex and there are some slightly idiosyncratic aspects to the language you have use to get R to work. That said there is lot more help around on <a href="http://stackoverflow.com/questions/tagged/r" target="_blank">forums</a> and some excellent introductory tutorials to get  you started. Here are a couple of worksheets I use to introduce the wonders of R.</p>
<p style="text-align: center;"><a href="http://spatialanalysis.co.uk/wp-content/uploads/2013/04/intro_R_map_eg.png"><img class=" wp-image-4043 aligncenter" alt="intro_R_map_eg" src="http://spatialanalysis.co.uk/wp-content/uploads/2013/04/intro_R_map_eg.png" width="428" height="425" /></a></p>
<p>The first is written by <a href="http://www.social-statistics.org/" target="_blank">Richard Harris</a> from the University of Bristol. You can download the worksheet <a href="http://www.social-statistics.org/wp-content/uploads/2012/12/intro_to_R1.pdf" target="_blank">here</a> and the example data from <a href="http://spatialanalysis.co.uk/wp-content/uploads/2013/04/Intro_R_Data.zip" target="_blank">here</a>. I like this worksheet because it is very applied (it is using a real dataset on an important problem), it gets you working with spatial data quickly and it also offers an automated run-through of some of the more advanced stats. It provides a great general introduction to R that can be a basis for more advanced worksheets and tutorials.</p>
<p style="text-align: center;"><a href="http://spatialanalysis.co.uk/wp-content/uploads/2010/09/Screen-shot-2010-09-27-at-09.25.581.png"><img class="wp-image-1450 aligncenter" alt="ggplot2 map" src="http://spatialanalysis.co.uk/wp-content/uploads/2010/09/Screen-shot-2010-09-27-at-09.25.581.png" width="496" height="359" /></a></p>
<p>The second worksheet is one that I have written as an introduction to spatial data visualisation with <a href="http://ggplot2.org/" target="_blank">ggplot2</a> (a data visualisation package in R). Download instructions<a href="http://spatialanalysis.co.uk/wp-content/uploads/2013/04/james_cheshire_ggplot_intro_blog.pdf" target="_blank"> here</a> and data <a href="http://spatialanalysis.co.uk/wp-content/uploads/2013/04/R-ggplot2-data.zip" target="_blank">here</a>. The code takes you through some of the key functions I often use in ggplot2 to create maps. It also includes faceting which enables you to create lots of graphics as small multiples on a single page. I use this a lot for maps such as the one below of New York Twitter languages:</p>
<p><a href="http://spatialanalysis.co.uk/2013/02/mapped-twitter-languages-york/"><img class="alignnone  wp-image-3990" alt="twitter_NY_lang_facet_sml" src="http://spatialanalysis.co.uk/wp-content/uploads/2013/02/twitter_NY_lang_facet_sml-585x1024.png" width="585" height="1024" /></a></p>
<p>Here are a couple of <a href="http://www.social-statistics.org/?p=764" target="_blank">additional worksheets</a> from <a href="http://rpubs.com/chrisbrunsdon" target="_blank">Chris Brunsdon</a> (University of Liverpool) that may be of interest to those who want to do more advanced spatial analysis and I have a few tutorials <a href="http://spatialanalysis.co.uk/r/">here</a>. I am sure there are many more good examples out there so feel free to post them in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://spatial.ly/2013/04/analysis-visualisation-spatial-data/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Mapped: Twitter Languages in New York</title>
		<link>http://spatial.ly/2013/02/mapped-twitter-languages-york/</link>
		<comments>http://spatial.ly/2013/02/mapped-twitter-languages-york/#comments</comments>
		<pubDate>Wed, 20 Feb 2013 09:48:30 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Featured Maps]]></category>
		<category><![CDATA[R Spatial]]></category>
		<category><![CDATA[Slideshow]]></category>
		<category><![CDATA[Visualisation]]></category>
		<category><![CDATA[Big data]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[new york]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://spatialanalysis.co.uk/?p=3978</guid>
		<description><![CDATA[Following the interest in our Twitter Tongues map for L [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://ny.spatial.ly/"><img class="alignnone  wp-image-3980" alt="NY_twitter_sml" src="http://spatialanalysis.co.uk/wp-content/uploads/2013/02/NY_twitter_sml.png" width="570" height="375" /></a></p>
<p>Following the interest in our <a href="http://twitter.mappinglondon.co.uk/">Twitter Tongues</a> map for London, <a href="https://twitter.com/edthink" target="_blank">Ed Manley</a> and I have teamed up with <a href="http://http://trendsmap.com/" target="_blank">Trendsmap</a> creator <a href="https://twitter.com/johnbarratt" target="_blank">John Barratt</a> to offer this snapshot of New York City&#8217;s Twitter languages. We have visualised the geography of about 8.5 million geo-located tweets collected between Jan 2010 and Feb 2013. Each tweet is marked by a slightly transparent dot coloured according to the language it was written in. Language was detected using Google’s <a href="http://code.google.com/p/chromium-compact-language-detector/" target="_blank">translation tools</a>. The above map (<a href="http://ny.spatial.ly">click for interactive version</a> courtesy of <a href="http://oliverobrien.co.uk/" target="_blank">Oliver O&#8217;Brien</a>) has the top ten languages plotted together and the one below takes the top 24 in turn (excluding English) and orders them by popularity. English (in grey above) is by far the most popular with Spanish (in blue above) taking the top spot amongst the other language groups.  Portuguese and Japanese take third and fourth respectively. Midtown Manhattan and JFK International Airport have, perhaps unsurprisingly, the most linguistically diverse tweets whilst specific languages shine through in places such as Brighton Beach (Russian), the Bronx (Spanish) and towards Newark (Portuguese). You can also spot international clusters on Liberty Island and Ellis Island and if you look carefully the tracks of ferry boats between them. Ed has written up some more in depth analysis of the <a href="http://urbanmovements.posterous.com/analysing-languages-in-the-new-york-twittersp" target="_blank">data here</a>.</p>
<p><a href="http://spatialanalysis.co.uk/wp-content/uploads/2013/02/twitter_NY_lang_facet_sml.png"><img class="alignnone size-large wp-image-3990" alt="twitter_NY_lang_facet_sml" src="http://spatialanalysis.co.uk/wp-content/uploads/2013/02/twitter_NY_lang_facet_sml-585x1024.png" width="585" height="1024" /></a></p>
<p><strong>Making the Maps</strong></p>
<p>For those interested, the maps above were produced using the <a href="http://www.r-project.org/">R software </a>platform with the <a href="http://ggplot2.org/">ggplot2 package</a>. Both coped surprisingly well with plotting 8.5 million points (it took about 15 minutes on my two year old iMac) and the results are really great. Here is the code I used to produce the black and white map above:</p>
<p><code>#two input data frames here. "lang_freqs" has the total frequency of each language and is ordered highest to lowest (this is used for the facet ordering) and "twit_lang" is a data frame with each tweet's location (lat, long) and its language (lang) (it therefore has 8.5 million rows).</code></p>
<p><code>#here I create a new column lang1 to twit_lang which is used to order the faceting.</code></p>
<p><code>labs&lt;-as.factor(lang_freqs$lang)</code><br />
<code>twit_lang$lang1 </code></p>
<p><code>p</code></p>
<p><code>p1&lt;-c(geom_point(data=twit_lang,aes(x=long, y=lat),colour="white", alpha=0.1, size=1.2))</code></p>
<p><code>p+p1+ quiet + facet_wrap(~lang1, ncol=4) + opts(strip.text.x=theme_text(size=8))+opts(strip.background = theme_rect(colour="white", fill="white"))<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://spatial.ly/2013/02/mapped-twitter-languages-york/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>London&#8217;s Oyster Card Flows</title>
		<link>http://spatial.ly/2013/01/londons-oyster-card-flows/</link>
		<comments>http://spatial.ly/2013/01/londons-oyster-card-flows/#comments</comments>
		<pubDate>Sat, 26 Jan 2013 14:52:58 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[London]]></category>
		<category><![CDATA[Spatial Analysis]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://spatial.ly/?p=4190</guid>
		<description><![CDATA[Here is an animation that Ollie O&#8217;Brien created a [...]]]></description>
				<content:encoded><![CDATA[<p><iframe width="500" height="375" src="http://www.youtube.com/embed/QQV3UHsZ_u4?feature=oembed" frameborder="0" allowfullscreen></iframe></p>
<p>Here is an animation that <a href="http://oliverobrien.co.uk/" target="_blank">Ollie O&#8217;Brien </a>created a couple of years ago for the “Sense and the City” exhibition at the London Transport Museum. The map shows the touch-ins (going into the network) and touch-outs (leaving the network) of Oyster cards at London’s tube and train stations, including a few beyond the Greater London boundary which still accept . As the animation moves forwards in 10-minute intervals during the typical weekday, the balance between touch-ins and touch-outs is shown by a colour scale. Red indicates the great majority of taps are touch-ins, and green indicates mainly touch-outs. White is the “neutral” colour, indicating that roughly as many people are entering the network as leaving it, at that period in time.</p>
]]></content:encoded>
			<wfw:commentRss>http://spatial.ly/2013/01/londons-oyster-card-flows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
