I just wanted to make a short note about the data set that I use in the regular
expression lecture about grep, regex or, and sub and Gsub.
So in that lecture, I use a specific data set, which is the Baltimore City Homicide
Event database. You can look at this data in map form by
going to this website up here and I'll put the link in Coursera so that you can find
it later. But basically the, the website is hosted
by the Baltimore Sun the city's newspaper, and they've kept track of every homicide
in the city that's occurred since 2007 up to the current, the present day.
So, for example, you can see here that there have been 171 homicides in 2012 in
Baltimore City. So the map is interactive.
You can do things like, you know, select on let's say, the past let's say, the past
six months. You can select a district of Baltimore if
you want or you can just look at all the districts.
A zip code an age of the victim, a gender of the victim,
And then the race of the victim, As well as the cause of death here.
There's a few different causes of death. So, you can show the results and I'm just
picking all the homicides that have occurred in the last six months. And then,
you'll get a map, a little Google map like this that'll show you where each victim
was found in the city and they're color coded by the cause of death.
So the red, you can see that the vast majority of the homicides here in the last
six months were red and that indicates a shooting.
And then, if you zoom in a little bit, let's say, if you zoom in on this portion
right here. You can see, the, you can click on one of
the markers and you'll see the name of the person the street, the street address of
where the person was found, a little bit of information, the race, gender, age, and
then where the person died, and then the cause of death which was determined in
this case to be a shooting. So you can click on the, each marker like
that. You'll get information about each victim
and you can kind of browse the map like this. and then if you scroll down a little
bit more, you'll see that there's a little bit of statistical analysis here, so
basically just a bar chart of the number of homicides that occurred each month.
And then, and they're color coded by the cause of death.
And the little line graph here, is the number of homicides per month in the
previous year. so, so, you can compare this year in the bars graph and the last
year's in the line graph. If you want to look at previous year's
data in this format, you can click on the little arrow over here.
And now, you can look at monthly homicides in 2011, monthly homicides in 2010, etc.,
like that. So feel free to take a look at this data.
unfortunately, the data set is not easily downloadable in, in a, in a batch form so
that we can look at it for example, and load it into R.
So, what I have done is essentially cut and paste the data from the HTML source,
and created a text file, which has a, which has lot of the HTML source in there,
but essentially boils down to having a one homicide record per line in the text file.
So, if you want to open, you can open up the text file, which I'll do right here.
I'll, first of all, unzip the file. And if you take a look at it, just in your
the text editor or whatever application you want to use, you'll notice that there
is a lot of text here. But basically, the first line of data
looks like this. So, this is the first line.
It does wrap around a little bit because it's too long for my screen.
But you can see there, there's information about lat, the latitude and longitude of
where the person was found the person's name, street address where they were
found, and some information about their race, gender, and age.
And the date that they were found and where they died.
And this person, in this case, this person died at shock trauma which is the
University of Maryland's emergency room. So, you can see there's one line per
victim. There's about a little over 1200 lines in
this file, So 1200 homicides over the last five
years. And so, you can take a look at this data
set. You can read it into R, or you can view it
on the map provided by the Baltimore Sun.