This post, my first in over year, improves upon the code in my last post. The crime-mapping app I posted in May 2017 included some kludgy, manual handling of dates, such that the categorical, rolling 12-month year labels were hard-coded, rather than dynamically updated with the data’s most recent date. This post presents a much smoother way to automatically assign those date labels, which obviates the need for a user to correctly, manually update that field when updating the data.Read More
Crime maps interest just about everyone. Government officials are interested in the need for and success of intervention programs, law enforcement officials are interested in policing needs, and private citizens are concerned about their safety and the safety of loved ones. This post presents code to create an interactive Shiny application that will allow the user to specify an address, the type of crime, and the time of day - or not, and instead just zoom around as their curiosity dictates - and see mapped crime incidents with dynamically adjusting annual crime stats in that specific area.
The data for this post come from the Baton Rouge, Louisiana Crime Incidents dataset.Read More
On April 9th, voters in New Orleans rejected a proposal to increase funding for police and fire departments. Crime rates are a recurring source of concern in New Orleans, and this vote prompts the question: what is the relationship between police presence and crime in New Orleans?
The data for this post (both on crime rates and on the number of police officers) come from the Federal Bureau of Investigation's Uniform Crime Reporting (UCR) program.Read More
This post demonstrates how to map change in a variable over time in a geographic area, allowing the user to scroll through time and selectively view dates of interest. It produces an interactive choropleth map, as the last post did, but whereas the last post was interactive in the sense that the user could zoom in on a specific geographic area, this map is interactive in the sense that the user can ‘zoom in’ on a specific point in time.
This map: In the wake of Hurricane Katrina, multiple New Orleans committees generated plans to rebuild the city; in some cases, these plans involved shifting the city’s footprint to move citizens out of more topographically vulnerable areas. The sequence of maps produced here answer the question: how quickly did various New Orleans zip codes re-populate after Hurricane Katrina, and how does the city’s current address density relate to pre-Katrina levels?Read More
This post produces an interactive map that features analysis output mapped onto the geographical region to which it applies. This specific map answers the question: which areas in and around New Orleans exhibited the most growth (or loss) in active addresses over the past two years?Read More
If you've needed to perform the same sequence of tasks or analyses over multiple units, you've probably found for loops helpful. They aren't without their challenges, however - as the number of units increases, the processing time increases. For large data sets, the processing time associated with a sequential for loop can become so cumbersome and unwieldy as to be unworkable. Parallel processing is a really nice alternative in these situations. It makes use of your computer's multiple processing cores to run the for loop code simultaneously across your list of units. This post presents code to:
- Perform an analysis using a conventional for loop.
- Modify this code for parallel processing.
To illustrate these approaches, I'll be working with the New Orleans, LA Postal Service addresses data set from the past couple of posts. You can obtain the data set here, and code to quickly transform it for these analyses here.
The question we'll be looking to answer with these analyses is: which areas in and around New Orleans have exhibited the greatest growth in the past couple of years?Read More