Pages Menu
TwitterRss
Categories Menu

Posted by on Dec 9, 2013 in R Spatial, Resources, Spatial Analysis | 12 comments

Introduction to Spatial Data and ggplot2

Introduction to Spatial Data and ggplot2

For those starting out with spatial data in R, Robin Lovelace and I have prepared this tutorial (funded as part of the University of Leeds and UCL Talisman project). Here we introduce a range of analysis skills before demonstrating how you can deploy the powerful graphics capabilities of ggplot2 to visualise your results. There is also some “bonus” material at the end to show how you can use ggplot2 for descriptive statistics and so on. The tutorial covers: -Introduction to ggplot2 -Map projections -Adding Google and Stamen basemaps -Clipping and joining spatial data -Aggregating spatial data -ggplot2 for descriptive statistics Download the data you need from here. This is a work in progress so we may add improvements as time goes on. We also have a few more tutorials in the pipeline that will be posted here in due course.   [iframe src=”http://rpubs.com/RobinLovelace/intro-spatial” width=”100%”...

Read More

Posted by on Feb 16, 2011 in Featured Maps, London, R Spatial, Visualisation | 6 comments

Mapping London’s Population Change 1801-2030

Mapping London’s Population Change 1801-2030

Buried in the London Datastore are the population estimates for each of the London Boroughs between 2001 – 2030. They predict a declining population for most boroughs with the exception of a few to the east. I was surprised by this general decline and also the numbers involved- I expected larger changes from one year to the next. I think this is because my perception of migration is of the volume of people moving rather than the net effects on the baseline population of these movements. I don’t envy the GLA for making predictions so far into the future, but can understand why they have to do it (think how long it took initiate Crossrail!). Last year I produced a simple animation showing past changes in London’s population density (data) and it provides a nice comparison to the above. In total I have squeezed 40 maps on this page! Technical Stuff These maps were all produced to demonstrate the mapping capabilities of R. The first uses ggplot2 (plus classInt + RColorBrewer) and is based on some code...

Read More

Posted by on Jan 10, 2011 in Resources, Visualisation | 5 comments

R interface to Google Chart Tools

R interface to Google Chart Tools

Hans Rosling eat your heart out! It is now possible to interface R statistics software to Google’s Gapminder inspired Chart Tools. The plots below were produced using the googleVis R package and three datasets from the Gapminder website. The first shows the relationship between income, life expectancy and population for 20 countries with the highest life expectancy in 1979 and the bottom plot shows the countries with the lowest 1979 life expectancy. Press play to see how the countries have faired over the past 50 years. You can also change the variables represented on each axes, the colours and the variable that controls the size of the bubbles. Data: all_date, Chart ID: MotionChart_2011-01-10-10-16-25 R version 2.12.1 (2010-12-16), Google Terms of Use Data: all_date, Chart ID: MotionChart_2011-01-10-10-10-46 R version 2.12.1 (2010-12-16), Google Terms of Use It was a bit fiddly to get the data formatted correctly and I couldn’t manage to get the complete dataset in one plot because my browser kept crashing (Chrome is best). Even with these teething...

Read More

Posted by on Jan 3, 2011 in R Spatial | 9 comments

Exporting KML from R

Exporting KML from R

Google Earth has become a popular way of disseminating spatial data. KML is the data format required to do this. It is possible to load almost any type of spatial data format into R and export it as a KML file. In my experience R seems much quicker at doing this than many well-known GIS platforms, such as ArcGIS. The worksheet below explains how. Data and Package Requirements: London Cycle Hire Locations. Download. Install the following packages (if you haven’t already done so): maptools, rgdal (Mac users may wish to see here first). Click here to view the tutorial...

Read More

Posted by on Nov 2, 2010 in R Spatial, Resources | 16 comments

Installing rgdal on Mac OS X

******Roger Bivand has kindly just emailed me to say: “Your 2 November blog about rgdal on OSX is very misleading. The CRAN rgdal page: http://cran.r-project.org/web/packages/rgdal/index.html says all you need to know unless you need extra drivers, or already have PROJ.4 and GDAL installed. Just do: setRepositories(ind=1:2) install.packages(“rgdal”) installs rgdal with all its external dependencies satisfied. It is kindly provided by Prof. Brian Ripley, and is presently running up-to-date GDAL.”****** This may offer a straightforward solution. I would be interested to hear how people get on. After running a spatial data analysis with R session today, it became apparent that there are one or two teething problems installing the important rgdal package on Mac OS X operating systems. The usual install.packages(“rgdal”) won’t work. My colleague Jon Reades did some digging around to find this solution. I have tested it and it seems to work fine. [Note that you’ll need to be comfortable with the Terminal. If you’re not, then find someone who is.] 1. Download the GDAL OS X install from kyngchaos...

Read More