The same parsing, rendering of shapefiles, and geocoding of foreclosure events reviewed up to this point can be done in a number of other platforms. The real strength of R is found in its extensive statistical functions and libraries.
The US Census Bureau collects an extensive range of socioeconomic data that are interesting for our purposes. We can download some data pertaining to total population and total housing units that are indexed by the same tracts we have used for our map. The FactFinder download center provides easy access to this data, as shown in Figure 2-1.
Then, select All Census Tracts in a County→Pennsylvania→Philadelphia County→Selected Detailed Tables, as shown in Figure 2-2.
Add the eight tables (P1,P13, P14, P31, P41, P53, P87,H33), click Next, download the file, and unzip it.
Figure 2-1. The Census Bureau page containing all census tracts data; Pennsylvania and Philadelphia County are selected from the drop-down menu
Figure 2-2. The Census Bureau page showing all available titles in the Philadelphia County region
Import this data into R, and use the function
str() to see the data contained in each column:
> censusTable2<-read.table("dc_dec_2000_sf3_u_data1.txt",sep="|", ...