犯罪是一個國際關注的問題,但它在不同的國家以不同的方式記錄和處理。 在美國,聯邦調查局(FBI)記錄了暴力犯罪和財產犯罪。 此外,每個城市都記錄了犯罪行為,一些城市發布了有關犯罪率的數據。 伊利諾伊州芝加哥市從2001年開始在線發布犯罪數據。
芝加哥是美國人口第三多的城市,人口超過270萬。在這個作業裡面,我們將關注一種特定類型的財產犯罪,稱為「汽車盜竊」,我們將使用R中的一些基本數據分析來了解芝加哥的汽車盜竊紀錄。請載入文件“data/mvtWeek1.csv”:以下是各欄位的描述:
ID
: a unique identifier for each observationDate
: the date the crime occurredLocationDescription
: the location where the crime occurredArrest
: whether or not an arrest was made for the crime (TRUE if an arrest was made, and FALSE if an arrest was not made)Domestic
: whether or not the crime was a domestic crime, meaning that it was committed against a family member (TRUE if it was domestic, and FALSE if it was not domestic)Beat
: the area, or “beat” in which the crime occurred. This is the smallest regional division defined by the Chicago police department.District
: the police district in which the crime occured. Each district is composed of many beats, and are defined by the Chicago Police Department.CommunityArea
: the community area in which the crime occurred. Since the 1920s, Chicago has been divided into what are called “community areas”, of which there are now 77. The community areas were devised in an attempt to create socially homogeneous regions.Year
: the year in which the crime occurred.Latitude
: the latitude of the location at which the crime occurred.Longitude
: the longitude of the location at which the crime occurred.【1.1】How many rows of data (observations) are in this dataset?
#
檢查各欄位的資料格式
#
類別(Factor) versus 字串(Character)
【1.2】How many variables are in this dataset?
#
【1.3】Using the “max” function, what is the maximum value of the variable “ID”?
#
【1.4】 What is the minimum value of the variable “Beat”?
#
【1.5】 How many observations have value TRUE in the Arrest variable (this is the number of crimes for which an arrest was made)?
#
【1.6】 How many observations have a LocationDescription value of ALLEY?
#
【2.1】 In what format are the entries in the variable Date?
#
#
#
#
【2.2】 What is the month and year of the median date in our dataset?
#
【2.3】 In which month did the fewest motor vehicle thefts occur?
#
【2.4】 On which weekday did the most motor vehicle thefts occur?
#
【2.5】 Which month has the largest number of motor vehicle thefts for which an arrest was made?
#
【3.1】 (a) In general, does it look like crime increases or decreases from 2002 - 2012? (b) In general, does it look like crime increases or decreases from 2005 - 2008? (c) In general, does it look like crime increases or decreases from 2009 - 2011?
#
【3.2】 Does it look like there were more crimes for which arrests were made in the first half of the time period or the second half of the time period?
#
【3.3】 For what proportion of motor vehicle thefts in 2001 was an arrest made?
#
【3.4】 For what proportion of motor vehicle thefts in 2007 was an arrest made?
#
【3.5】 For what proportion of motor vehicle thefts in 2012 was an arrest made?
#
【4.1】 Which locations are the top five locations for motor vehicle thefts, excluding the “Other” category? You should select 5 of the following options.
#
【4.2】 How many observations are in Top5?
#
【4.3】 One of the locations has a much higher arrest rate than the other locations. Which is it?
#
【4.4】 On which day of the week do the most motor vehicle thefts at gas stations happen?
#
【4.5】 On which day of the week do the fewest motor vehicle thefts in residential driveways happen?
#