Writing a Spatial Function: The Location Quotient
In some cases it is necessary to conduct the same analysis multiple times on either the same or different data. In such circumstances it is worth writing a function to simplify the code. In this example the location quotient provides a simple calculation easily written in to a function.
The location quotient (LQ) is an index for comparing a region’s share of a particular activity with the share of that same activity found at a more aggregate spatial level (a good book on this kind of thing is Burt et al.). In this example we take a shapefile of London Boroughs that contains information on the population of each borough and the percentage of sports participation in each borough. In this case there is little point in calculating the LQ as the percentage alone would be more meaningful. The focus here is how to undertake the methods, not their appropriate use, or the validity of the results.
London Sport Participation Shapefile: Download (requires unzipping)
Install the following packages (if you haven’t already done so):