install.packages("tidyverse")
## Installing package into '/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.6'
## (as 'lib' is unspecified)

Instructions to Students

This assignment is designed to simulate a scenario where you are taking over someone’s existing work, and continuing with it to draw some further insights.

This is a real world dataset taken from the Crime Statistics Agency Victoria. https://www.crimestatistics.vic.gov.au/download-data, specifically the data called “Data tables - Spotlight: Burglary/Break and Enter Offences Recorded in Victoria visualisation - year ending December 2018 (XLSX, 4.4 MB)”. The raw data is used for this assignment, with no changes made.

You are writing a quick summary of the data, following along from guidance from Amelia, and some of the questions your manager has. This is not a formal report, but rather something you are giving to your manager that describes the data, and some interesting insights. We have written example text for the first section on Monash, and would like you to explore another area. Our example writings are a good example of how to get full marks.

Your “colleague”, Amelia (in the text treatment below) has written some helpful hints throughout the assignment to help guide you.

Questions that are work marks are indicated with ** at the start and end of the question, as well as a number of marks in parenthesis.

Marking + Grades

This assignment will be worth 4% of your total grade, and will be marked out of 16 marks total.

  • 3 Marks for grammar and clarity. You must write in complete sentences and do a spell check.
  • 3 Marks for overall presentation of the data visualisations
  • 10 marks for the questions

  • Your marks will then be weighted according to peer evaluation.

  • Sections that contain marks are indicated with **, and will have the number of marks indicated in parentheses. For example:

# `**` What are the types of item divisions? How many are there? (0.5 Mark) `**`

A Note on skills

As of week 1, you have seen some of the code used here, but I do not expect you to know immediately what the code below does. This is a challenge for you! We will be covering skills on data summary and data visualisation in the next two weeks, but this assignment is designed to simulate a real life work situation - this means that there are some things where you need to “learn on the job”. But the vast majority of the assignment will cover things that you will have seen in class, or the readings.

Remember, you can look up the help file for functions by typing ?function_name. For example, ?mean. Feel free to google questions you have about how to do other kinds of plots, and post on the ED if you have any questions about the assignment.

How to complete this assignment.

To complete the assignment you will need to fill in the blanks for function names, arguments, or other names. These sections are marked with *** or ___. At a minimum, your assignment should be able to be “knitted” using the knit button for your Rmarkdown document.

If you want to look at what the assignment looks like in progress, but you do not have valid R code in all the R code chunks, remember that you can set the chunk options to eval = FALSE. If you do this, please remember to ensure that you remove this chunk option or set it to eval = TRUE when you submit the assignment, to ensure all your R code runs.

You will be completing this assignment in your assigned groups. A reminder regarding our recommendations for completing group assignments:

  • Each member of the group completes the entire assignment, as best they can.
  • Group members compare answers and combine it into one document for the final submission.

Your assignments will be peer reviewed, and results checked for reproducibility. This means:

  • 25% of the assignment grade will come from peer evaluation.
  • Peer evaluation is an important learning tool.

Each student will be randomly assigned another team’s submission to provide feedback on three things:

  1. Could you reproduce the analysis?
  2. Did you learn something new from the other team’s approach?
  3. What would you suggest to improve their work?

Due Date

This assignment is due in by close of business (5pm) on Friday 16th August. You will submit the assignment via ED. Please change the file name to include your teams name. For example, if you are team dplyr, your assignment file name could read: “assignment-1-2019-s2-team-dplyr.Rmd”

Treatment

You work as a data scientist in the well named company, “The Security Company”, that sells security products: alarms, surveillance cameras, locks, screen doors, big doors, and so on.

It’s your second day at the company, and you’re taken to your desk. Your boss says to you:

Amelia has managed to find this treasure trove of data - get this: crime statistics on breaking and entering around Victoria for the past years! Unfortunately, Amelia just left on holiday to New Zealand. They discovered this dataset the afternoon before they left on holiday, and got started on doing some data analysis.

We’ve got a meeting coming up soon where we need to discuss some new directions for the company, and we want you to tell us about this dataset and what we can do with it. We want to focus on Monash, since we have a few big customers in that area, and then we want you to help us compare that whatever area has the highest burglary.

You’re in with the new hires of data scientists here. We’d like you to take a look at the data and tell me what the spreadsheet tells us. I’ve written some questions on the report for you to answer, and there are also some questions from Amelia I would like you to look at as well.

Most Importantly, can you get this to me by COB Friday 16th August (COB = Close of Business at 5pm).

I’ve given this dataset to some of the other new hire data scientists as well, you’ll all be working as a team on this dataset. I’d like you to all try and work on the questions separately, and then combine your answers together to provide the best results.

From here, you are handed a USB stick. You load this into your computer, and you see a folder called “vic-crime”. In it is a folder called “data-raw”, and an Rmarkdown file. It contains the start of a data analysis. Your job is to explore the data and answer the questions in the document.

Note that the text that is written was originally written by Amelia, and you need to make sure that their name is kept up top, and to pay attention to what they have to say in the document! # Data read in.

Amelia: First, let’s read in the data using the function read_excel() from the readxl package, and clean up the names, using the rename function from dplyr.

library(readxl)
crime_raw <- read_excel("Data_tables_spotlight_burglary_break_and_enter_visualisation_year_ending_December_2018_v3.xlsx", 
    sheet = "Table 06")

library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
crime <- crime_raw %>%
  rename(year = `Year ending December`,
         local_gov_area = `Local Government Area`,
         offence_subgroup = `Offence Subgroup`,
         item_division = `Property Item Division`,
         item_subdivision = `Property Item Subdivision`,
         n_property_items = `Number of Property Items`)

Amelia: Let’s print the data and look at the first few rows.

crime
## # A tibble: 43,830 x 6
##     year local_gov_area offence_subgroup item_division item_subdivision
##    <dbl> <chr>          <chr>            <chr>         <chr>           
##  1  2009 Alpine         B321 Residentia… Cash/Document Cash/Document   
##  2  2009 Alpine         B321 Residentia… Cigarettes/L… Cigarettes/Liqu…
##  3  2009 Alpine         B321 Residentia… Electrical A… Other Electrica…
##  4  2009 Alpine         B321 Residentia… Electrical A… Video Game Unit 
##  5  2009 Alpine         B321 Residentia… Firearms/Amm… Firearms/Ammuni…
##  6  2009 Alpine         B321 Residentia… Food          Food            
##  7  2009 Alpine         B321 Residentia… Garden Items  Garden Items    
##  8  2009 Alpine         B321 Residentia… Household It… Household Items 
##  9  2009 Alpine         B321 Residentia… Jewellery     Jewellery       
## 10  2009 Alpine         B321 Residentia… Marine Prope… Marine Property 
## # … with 43,820 more rows, and 1 more variable: n_property_items <dbl>
crime_raw
## # A tibble: 43,830 x 6
##    `Year ending De… `Local Governme… `Offence Subgro… `Property Item …
##               <dbl> <chr>            <chr>            <chr>           
##  1             2009 Alpine           B321 Residentia… Cash/Document   
##  2             2009 Alpine           B321 Residentia… Cigarettes/Liqu…
##  3             2009 Alpine           B321 Residentia… Electrical Appl…
##  4             2009 Alpine           B321 Residentia… Electrical Appl…
##  5             2009 Alpine           B321 Residentia… Firearms/Ammuni…
##  6             2009 Alpine           B321 Residentia… Food            
##  7             2009 Alpine           B321 Residentia… Garden Items    
##  8             2009 Alpine           B321 Residentia… Household Items 
##  9             2009 Alpine           B321 Residentia… Jewellery       
## 10             2009 Alpine           B321 Residentia… Marine Property 
## # … with 43,820 more rows, and 2 more variables: `Property Item
## #   Subdivision` <chr>, `Number of Property Items` <dbl>

Amelia: And what are the names of the columns in the dataset?

names(crime)
## [1] "year"             "local_gov_area"   "offence_subgroup"
## [4] "item_division"    "item_subdivision" "n_property_items"

Amelia: How many years of data are there?

summary(crime$year)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    2009    2011    2014    2014    2016    2018

Amelia: We have data that goes from 2009 until 2018, that’s nine years of data!

How many Local Government Areas (LGAs) are there? And what are the LGAs called?

n_distinct(crime$local_gov_area)
## [1] 80
unique(crime$local_gov_area)
##  [1] "Alpine"               "Ararat"               "Ballarat"            
##  [4] "Banyule"              "Bass Coast"           "Baw Baw"             
##  [7] "Bayside"              "Benalla"              "Boroondara"          
## [10] "Brimbank"             "Buloke"               "Campaspe"            
## [13] "Cardinia"             "Casey"                "Central Goldfields"  
## [16] "Colac-Otway"          "Corangamite"          "Darebin"             
## [19] "East Gippsland"       "Frankston"            "Gannawarra"          
## [22] "Glen Eira"            "Glenelg"              "Golden Plains"       
## [25] "Greater Bendigo"      "Greater Dandenong"    "Greater Geelong"     
## [28] "Greater Shepparton"   "Hepburn"              "Hindmarsh"           
## [31] "Hobsons Bay"          "Horsham"              "Hume"                
## [34] "Indigo"               "Kingston"             "Knox"                
## [37] "Latrobe"              "Loddon"               "Macedon Ranges"      
## [40] "Manningham"           "Mansfield"            "Maribyrnong"         
## [43] "Maroondah"            "Melbourne"            "Melton"              
## [46] "Mildura"              "Mitchell"             "Moira"               
## [49] "Monash"               "Moonee Valley"        "Moorabool"           
## [52] "Moreland"             "Mornington Peninsula" "Mount Alexander"     
## [55] "Moyne"                "Murrindindi"          "Nillumbik"           
## [58] "Northern Grampians"   "Port Phillip"         "Pyrenees"            
## [61] "Queenscliffe"         "South Gippsland"      "Southern Grampians"  
## [64] "Stonnington"          "Strathbogie"          "Surf Coast"          
## [67] "Swan Hill"            "Towong"               "Wangaratta"          
## [70] "Warrnambool"          "Wellington"           "West Wimmera"        
## [73] "Whitehorse"           "Whittlesea"           "Wodonga"             
## [76] "Wyndham"              "Yarra"                "Yarra Ranges"        
## [79] "Yarriambiack"         "Victoria"

Amelia: That’s a lot of areas - about 80!

What are the types of offence subgroups? How many are there?

unique(crime$offence_subgroup)
## [1] "B321 Residential non-aggravated burglary"    
## [2] "B322 Non-residential non-aggravated burglary"
## [3] "B311 Residential aggravated burglary"        
## [4] "B319 Unknown aggravated burglary"            
## [5] "B329 Unknown non-aggravated burglary"        
## [6] "B312 Non-residential aggravated burglary"
n_distinct(crime$offence_subgroup)
## [1] 6

Amelia: Remember that you can learn more about what these functions do by typing ?unique or ?n_distinct into the console.

** What are the types of item divisions? How many are there? (0.5 Mark) **

unique(crime$item_division)
##  [1] "Cash/Document"         "Cigarettes/Liquor"    
##  [3] "Electrical Appliances" "Firearms/Ammunition"  
##  [5] "Food"                  "Garden Items"         
##  [7] "Household Items"       "Jewellery"            
##  [9] "Marine Property"       "Other"                
## [11] "Personal Property"     "Sporting Goods"       
## [13] "Tools"                 "Tv/Vcr"               
## [15] "Clothing"              "Photographic Equip"   
## [17] "Power Tools"           "Car Accessories"      
## [19] "Weapons"               "Domestic Pets"        
## [21] "Furniture"             "Timber/Build Mat"     
## [23] "Police Property"       "Livestock"            
## [25] "Explosives"
n_distinct(crime$item_division)
## [1] 25

25 # ** What are the types of item subdivisions? (0.5 Mark) **

unique(crime$item_subdivision)
##  [1] "Cash/Document"               "Cigarettes/Liquor"          
##  [3] "Other Electrical Appliances" "Video Game Unit"            
##  [5] "Firearms/Ammunition"         "Food"                       
##  [7] "Garden Items"                "Household Items"            
##  [9] "Jewellery"                   "Marine Property"            
## [11] "Other Property Items"        "Personal Property"          
## [13] "Sporting Goods"              "Tools"                      
## [15] "Tv/Vcr"                      "Clothing"                   
## [17] "Photographic Equip"          "Power Tools"                
## [19] "Car Accessories"             "Computer"                   
## [21] "Mobile Phone"                "Weapons"                    
## [23] "Key"                         "Domestic Pets"              
## [25] "Speaker"                     "Furniture"                  
## [27] "Timber/Build Mat"            "Police Property"            
## [29] "Livestock"                   "Explosives"                 
## [31] "Laptop"                      "Tablet Computer"
n_distinct(crime$item_subdivision)
## [1] 32

** What is the summary of the number of property items? (0.5 Mark) **

summary(crime$n_property_items)
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
##     1.00     2.00     7.00    74.15    29.00 45027.00

** Can you tell me what each row represents, and what each of the columns measure? (1 Mark) **

Amelia: We need to describe what each row of the data represents, and take our best guess at what we think each column measures. It might be worthwhile looking through the excel sheet in the data folder, or on the website where the data was extracted.

By looking at the data set we can see what each rows are different observations the obversations in this case are a burglaries which occured with the different results determined by the columns or variable. The different columns are variables each representing a different thing: year= what year the robery took place, local gov area= in what suburb or area it occured, offence subgroup= what what type of police code the incident was when it was called, item devision= what type of items were stolen, item subdivision= what type of items were stolen but more specific, number of property items= the amount of tiems which were stolen.

Is there a yearly trend in the total number of items stolen per year?

Amelia: Let’s group by year and then sum up the number of property items. Then we can take this information and use ggplot to plot the year on the x axis, and n_items on the y axis, and number of items as a column with geom_col().

crime_year_n_items <- crime %>%
  group_by(year) %>%
  summarise(n_items = sum(n_property_items))


library(ggplot2)
ggplot(crime_year_n_items,
       aes(x = year,
           y = n_items)) + 
  geom_col()

Amelia: I try and write three sentences complete about what I learn in a graphic. You should start with a quick summary of what the graphic shows you. Then, describe what is on the x axis, the y axis, and any other colours used to separate the data. You then need to describe what you learn. So, I would say:

“A summary of the number of items stolen from burglaries for each year from 2009 until 2018. On the x axis is each year, and the y axis is the number of items stolen. We learn that the number of items stolen stays around 300,000 (3e+05 means the number 3 with 5 zeros after it), but from 2016, the number of items stolen has decreased each year.”

Look at burglary around Monash and tell me about it?

Amelia: Let’s filter the data down to the ‘Monash’ LGAs.

crime_monash <- crime %>% filter(local_gov_area == "Monash")

crime_monash
## # A tibble: 689 x 6
##     year local_gov_area offence_subgroup item_division item_subdivision
##    <dbl> <chr>          <chr>            <chr>         <chr>           
##  1  2009 Monash         B311 Residentia… Cash/Document Cash/Document   
##  2  2009 Monash         B311 Residentia… Electrical A… Computer        
##  3  2009 Monash         B311 Residentia… Electrical A… Other Electrica…
##  4  2009 Monash         B311 Residentia… Electrical A… Video Game Unit 
##  5  2009 Monash         B311 Residentia… Jewellery     Jewellery       
##  6  2009 Monash         B311 Residentia… Other         Key             
##  7  2009 Monash         B311 Residentia… Other         Other Property …
##  8  2009 Monash         B311 Residentia… Personal Pro… Personal Proper…
##  9  2009 Monash         B311 Residentia… Sporting Goo… Sporting Goods  
## 10  2009 Monash         B311 Residentia… Tv/Vcr        Tv/Vcr          
## # … with 679 more rows, and 1 more variable: n_property_items <dbl>

Is crime in Monash increasing?

Amelia: Let’s count the number of crimes per year.

crime_count_monash <- crime_monash %>% count(year) 

ggplot(crime_count_monash,
       aes(x = year,
           y = n)) + 
  geom_col()

Amelia: This plot shows the number of burglary crimes per year across Victoria. The x axis shows the year, and the y axis shows the number of crimes scored for that year. There appears to be a slight upwards trend, but it looks variable for each year.

What are the most common offences in Monash across all years?

Amelia: We count the number of observations in each offence_subgroup to tell us which are the most common.

crime_monash %>% count(offence_subgroup)
## # A tibble: 6 x 2
##   offence_subgroup                                 n
##   <chr>                                        <int>
## 1 B311 Residential aggravated burglary           117
## 2 B312 Non-residential aggravated burglary        10
## 3 B319 Unknown aggravated burglary                 6
## 4 B321 Residential non-aggravated burglary       273
## 5 B322 Non-residential non-aggravated burglary   248
## 6 B329 Unknown non-aggravated burglary            35

Amelia: The top subgroups are “B321 Residential non-aggravated burglary”, at 273, followed by “B322 Non-residential non-aggravated burglary” at 248.

Are any of these offences increasing over time?

Amelia: We take the crime data, then group by year, and count the number of offences in each year. We then plot this data. On the x axis we have year. On the y axis we have n, the number of crimes that take place in a subgroup in a year, and we are colouring according to the offence subgroup, and drawing this with a line, then making sure that the limits go from 0 to 30.

crime_year_offence_monash <- crime_monash %>%
  group_by(year) %>%
  count(offence_subgroup)

ggplot(crime_year_offence_monash,
       aes(x = year,
           y = n,
           colour = offence_subgroup)) + 
  geom_line() + 
  lims(y = c(0, 35)) # Makes sure the y axis goes to zero

Amelia: This shows us that the most common offence is “residential non-aggravated burglary”, over time we are able to see and increase in B311 thena very slight increas B312, B319, B322. The only Offence subgroup to decrease was B329.

What are the most common items stolen in Monash?

Amelia: We count up the item subdivisions, which is the smallest category on items. We then plot number of times an item is stolen, and reorder the y axis so that the items are in order of most to least.

crime_items_monash <- crime_monash %>% 
  count(item_subdivision)

# save an object of the maximum number of items stolen
# to help construct the plot below.
max_items_stolen <- max(crime_items_monash$n)

ggplot(crime_items_monash,
       aes(x = n,
           y = reorder(item_subdivision, n))) + 
  geom_point() + 
  lims(x = c(0, max_items_stolen)) # make sure x axis goes from 0

Amelia: In monash the most stolen items are cash and documents which is ahead of all other items which have been stolen, this amounting 38.

Using all the crime data, what are the top 5 local government areas for total burglaries?

Amelia: This could be where we focus our next marketing campaign! Let’s take the crime data, then count the number of rows in each local_cov_area, and take the top 5 results using top_n, and arrange in descending order by the column “n”

crime %>%
  count(local_gov_area) %>%
  top_n(n = 5) %>%
  arrange(desc(n))
## Selecting by n
## # A tibble: 5 x 2
##   local_gov_area      n
##   <chr>           <int>
## 1 Victoria         1335
## 2 Casey             831
## 3 Wyndham           830
## 4 Greater Geelong   828
## 5 Brimbank          817

1.Victoria 2.Casey 3.Wyndham 4.Greater Geelong 5.Brimbank # (**) Which LGA had the most crime? (0.5 Mark) (**)

Victoria had the most crime of all the different local government Areas, at 1335, the second highest was casey at 831.

** Subset the data to be the LGA with the most crime. (0.5 Mark) **

crime_victoria <- crime %>% 
  filter(local_gov_area == "Victoria")
crime_victoria
## # A tibble: 1,335 x 6
##     year local_gov_area offence_subgroup item_division item_subdivision
##    <dbl> <chr>          <chr>            <chr>         <chr>           
##  1  2009 Victoria       B311 Residentia… Car Accessor… Car Accessories 
##  2  2009 Victoria       B311 Residentia… Cash/Document Cash/Document   
##  3  2009 Victoria       B311 Residentia… Cigarettes/L… Cigarettes/Liqu…
##  4  2009 Victoria       B311 Residentia… Clothing      Clothing        
##  5  2009 Victoria       B311 Residentia… Electrical A… Computer        
##  6  2009 Victoria       B311 Residentia… Electrical A… Other Electrica…
##  7  2009 Victoria       B311 Residentia… Electrical A… Speaker         
##  8  2009 Victoria       B311 Residentia… Electrical A… Video Game Unit 
##  9  2009 Victoria       B311 Residentia… Firearms/Amm… Firearms/Ammuni…
## 10  2009 Victoria       B311 Residentia… Food          Food            
## # … with 1,325 more rows, and 1 more variable: n_property_items <dbl>

Repeat the previous analysis, but compare Monash with the rest of the data.

** Is crime in Victoria increasing? (1 Mark) **

crime_count_victoria <- crime_victoria %>% count(year) 

ggplot(crime_count_victoria,
       aes(x = year,
           y = n)) + 
  geom_col()

Bere we can see that the crime in Victoria is constant there is no apparent trend which can be made

** What are the most common offences at victoria across all years? (1 Marks) **

crime_victoria %>%
  count(offence_subgroup)
## # A tibble: 6 x 2
##   offence_subgroup                                 n
##   <chr>                                        <int>
## 1 B311 Residential aggravated burglary           287
## 2 B312 Non-residential aggravated burglary       154
## 3 B319 Unknown aggravated burglary                29
## 4 B321 Residential non-aggravated burglary       308
## 5 B322 Non-residential non-aggravated burglary   308
## 6 B329 Unknown non-aggravated burglary           249

The most common offences in Victoria is B321(Residential non-aggravated burglary) and B322(non-residentialnon-aggrevated burglary) as they have the same count of 308.

** Are any of these offences increasing over time? (1 Mark) **

crime_year_offence_victoria <- crime_victoria %>%
  group_by(year) %>%
  count(offence_subgroup)

ggplot(crime_year_offence_victoria,
       aes(x = year,
           y = n,
           colour = offence_subgroup)) + 
  geom_line() + 
  lims(y = c(0, 35)) # Makes sure the y axis goes to zero

Amelia: I would write three sentences complete about what I learn in this graphic. You should start with a quick summary of what the graphic shows you. Then, describe what is on the x axis, the y axis, and any other colours used to separate the data. You then need to describe what you learn.

a)The graph below shows the trend of offences which happened in Victoria from 2009 to 2018. The x axis is the year and the y axis is number of offences which occured, while the lines of orange, yellow, green, blue, dark blue and pink represent the cateories of offences which are Residential aggravated burglary, Non-residential aggravated burglary,Unknown aggavated burglary,Residential non-aggravated burglary,Non-residential non-aggravated burglary and Unknown non-aggravated burglary. As shown in this graph,B311,B321 and B322 remained relatively stable with 30 approximately.B329 had a sharp decline and it was 22 roughly in 2018. B312 increased slightly during this period and B319 was fluctuated but fell overall.

What are the most common subdivision items stolen in Victoria?

crime_items_victoria <- crime_victoria %>% 
  count(item_subdivision)

ggplot(crime_items_victoria,
       aes(x = n,
           y = reorder(item_subdivision, n))) + 
  geom_point()

The most common subdivivision areas in Victoria are both Personal property and cash/documents at 55. These two have both the highet item subdivision compared to all ohers.

Combine Monash with the top crime LGA area into one data set using bind_rows()

Amelia: You can stack the data together using bind_rows().

crime_top_monash <- bind_rows(crime_monash,
                              crime_victoria)

Amelia: Use ggplot to create two separate plots for each local government area using facet_wrap() on local government area.

crime_year_offence_both <- crime_top_monash %>%
  group_by(year, local_gov_area) %>%
  count(offence_subgroup)

gg_crime_offence <- ggplot(crime_year_offence_both,
       aes(x = year,
           y = n,
           colour = offence_subgroup)) + 
  geom_line() + 
  facet_wrap(vars(local_gov_area))

gg_crime_offence

crime_items_both <- crime_top_monash %>% 
  group_by(local_gov_area) %>%
  count(item_subdivision)

ggplot(crime_items_both,
       aes(x = n,
           y = reorder(item_subdivision, n), # reorder the points
           colour = local_gov_area)) +
  geom_point()

** Do you have any recommendations about future directions with this dataset? Is there anything else in the excel spreadsheet we could look at? (2 Mark) **

Amelia: I was planning on looking at the other tabs in the spreadsheet to help us use information on the tool used to break in. How could we use what is in there? And what is in there that looks useful?

In future it would be more effective to add the LGA rate per 100,000 population. this data will help to paint a better picture to where the areas which are more dangerous in terms of burglaries are. As it is obvious that in areas with greater population there will be more crimes and burglaries occuring.This data will help to see where more funds should be spent in order to fight the problems. In Table07 commit from day and commit from time. This can help us as it tells us the most common time and day at ehich the crimes occur, this giving indicatations at which times we should be more carefull and deploy more protective force, for example, increasing the number of patrols at that time.

** For our presentation to stake holders, you get to pick one figure to show them, which of the ones above would you choose? Why? Recreate the figure below here and write 3 sentences about it (2.5 Marks) **

I would include the following figure:

crime_year_offence_both <- crime_top_monash %>%
  group_by(year, local_gov_area) %>%
  count(offence_subgroup)

gg_crime_offence <- ggplot(crime_year_offence_both,
       aes(x = year,
           y = n,
           colour = offence_subgroup)) + 
  geom_line() + 
  facet_wrap(vars(local_gov_area))

gg_crime_offence

Amelia: Remember, when you are describing data visualisation, You should start with a quick summary of what the graphic shows you. Then, describe what is on the x axis, the y axis, and any other colours used to separate the data. You then need to describe what you learn.

Amelia: Remeber to include the graphic again below.

This graphs shows the trend in crime count by offence subgroup in Victoria and Monash area from 2009-2019. Different colours represent different crime subgroup which are showed in the legend on the right of the graphs. The x axis shows the years and y axis shows the crime count. As we can see, on average, crime is increasing this leading to higher demand for security. In Victoria, offences count stayed the same and increased slightly over time and some offence group even decreased significantly. While in Monash, offences counts are increasing significantly by almost all subgroups except for B329. This could be due the market of security products is already saturated in Victoria, with large supply of products, it helps keep crime rates from increasing significantly and companies have to reduces their margins down to keep competitive advantage. Our reccommendation for the shareholders is they should focus on opening new shops and target their advertising strategy in Monash, which is a new emerging area with more and more people coming in and crime rates rising sharply in the last 10 years. The company can stay away from the competitive Victoria and shift their focus on new emerging area with huge opportunity to take a majority part in the market share of security products. Although the count for crime in victoria is much higher the population factor needs to be considered as the Monash’s population is much lower we need to expect the level of crime to be much lower. As stated above in the previous statement it would be useful to include data on LGA rate per 100,000 population as this will give us a better comparison as to what area should be the focus.

References

Amelia: I have got to remember to cite all the R packages that I have used, and any Stack Overflow questions, blog posts, text books, from online that I have used to help me answer questions.

Data downloaded from https://www.crimestatistics.vic.gov.au/download-data

Packages used (look for things which were loaded with library()): * ggplot2 * dplyr * …