Column

Year by Year Scam Losses (in million) and No of reports.

Average payment per Scam reports by each State on 2020.

Column

Data breach statistics for 2019 & 2020

  • Interactive 3 Layers Treemap, click to discover more.

Top SCAMS in Australia for 2019 and 2020.

Data Reference

---
title: "Scam and Data Breach Dashboard for Australia"
author: "by: Kamrul Hasan"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    social: menu
    source_code: embed
editor_options: 
  chunk_output_type: console
---


```{r setup, include=FALSE}
# First load all of the libraries required for the project
library(highcharter)
library(dplyr)
library(viridisLite)
library(treemap)
library(flexdashboard)
library(RColorBrewer)
library(tidyverse)
library(reshape2)
library(plotly)
library(ozmaps)
library(sf)

# Customized theme settings
thm <- 
  hc_theme(
    colors = c("#1a6ecc", "#434348", "#90ed7d"),
    chart = list(
      backgroundColor = "transparent",
      style = list(fontFamily = "Source Sans Pro")
    ),
    xAxis = list(
      gridLineWidth = 1
    )
  )

```

Column {data-width=600}
-----------------------------------------------------------------------

### Year by Year Scam Losses (in million) and No of reports.


```{r, fig.width=14, message=FALSE}
# Load year by year Scam data to read and process. 

Scam_by_year <- read_csv("Data/Scam_data_perYear.csv")
Scam_bar_df <- Scam_by_year %>% select(Year, group, Loss_in_million)
Scam_line_df <- Scam_by_year %>% select(Year, Scam_reports)

# Generate bar chart and a line graph over the bar chart for the scam data.

p_bar <- ggplot(data = Scam_bar_df, aes(x = Year, y = Loss_in_million)) +
  geom_bar(stat = "identity", position = "dodge", fill = "steelblue") +
  geom_text(aes(label = Loss_in_million),  vjust = 1.5, colour = "white") +
  expand_limits(x = 2020, y = 225) +
  scale_x_continuous(expand = c(0,0), breaks =   c(2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020)) + 
  theme(
    text = element_text(size=28),
    axis.text = element_text(size = 20),
    axis.title = element_text(size = 24, face = "bold"),
    axis.text.x = element_text(angle = 90, hjust = 1),
  ) +
  ylab("Losses in million") +
  labs(title = "Number of SCAMS in Australia") +
  labs(subtitle = "data from 2009 to 2020") +
  # Sett the line graph over bar chart
  geom_line(data = Scam_line_df, aes(x = Year, y = Scam_reports / 1000, group = 1, linetype = "No of Reports"), inherit.aes = FALSE) +
  scale_linetype_manual(NULL, values = 1) +
  # Sett points on the line graph
  geom_point(data = Scam_line_df, aes(x = Year, y = Scam_reports / 1000, group = 1), inherit.aes = FALSE) +
  scale_y_continuous(expand = c(0,0), sec.axis = sec_axis(~. * 1000, name = "No of Reports")) +
  theme(legend.background = element_rect(fill = "transparent"), 
      legend.box.background = element_rect(fill = "transparent", colour = NA),
      legend.key = element_rect(fill = "transparent"), 
      legend.spacing = unit(-1, "lines"))

# Load the visuals 

p_bar

```

### Average payment per Scam reports by each State on 2020.

```{r, fig.width=14, message=FALSE}
# Load Australian state based Scam data to read and process. 

State_data <- read_csv("Data/State_new_data.csv")
State_data$Total_Losses <- (as.numeric(gsub('[$,]', '', State_data$Total_Losses)))
State_data$Avg_pay <- State_data$Total_Losses/State_data$Total_Report_no

# Load the sf package to generate Australian map

sf_oz <- ozmap_data("states")
p1 <- ggplot(data = sf_oz) + geom_sf()

# Create the data frame from dataset

Avg_scam_pay <- c(
  713.22
  ,854.97
  ,818.98
  ,562.80
  ,519.63
  ,568.41
  ,407.01
  ,432.33
  ,0)

# Process the data with sf package.

sf_oz$Avg_scam_pay <- Avg_scam_pay

# Generate map with sf package in the Australian map. 

p1 <- ggplot(data = sf_oz, aes(fill = Avg_scam_pay), label = Avg_scam_pay, vjust = "top", hjust="left") + geom_sf() +
  #geom_text(aes(x = long, y = lat, label= Avg_scam_pay, vjust = "top", hjust="left")) +
  scale_fill_gradient(low = "yellow", high = "red", na.value = NA) +
  labs(title = "Average Scam Pay by different States of Australia ") +
  labs(subtitle = "Avg Scam Payment = Total losses divided by no of reports") +
  theme_classic() +
  theme(axis.line = element_blank()) +
  theme(axis.text = element_blank()) +
  theme(axis.ticks = element_blank()) 

# Load the map with state by state data.

ggplotly(p1)

```

Column {.tabset data-width=400}
-----------------------------------------------------------------------

### Data breach statistics for 2019 & 2020
- Interactive 3 Layers Treemap, click to discover more.

```{r, fig.keep='none', message=FALSE}
# Load Data breaches report outcome as data frame to read and process.

Breach_data <- read_csv("Data/Data_breach_byCategory.csv")

set.seed(0)

Breach_data_df <- Breach_data %>%
  group_by(Breach_Category, Breach_SubCategory, Breach_Primary_Category) %>% arrange(desc(No_Breaches))

# Set color palette to use in the Treemap

cols <- brewer.pal(8, "Pastel1")


# Generate and load the Treemap with Highcharter package

dout <- data_to_hierarchical(Breach_data_df, c(Breach_Category, Breach_SubCategory, Breach_Primary_Category), No_Breaches,
                             colors = cols)

hchart(dout, 
       type = "treemap",
       layoutAlgorithm = "squarified",
       allowDrillToNode = TRUE)

```

### Top SCAMS in Australia for 2019 and 2020.

```{r, message=FALSE}
# Load Top scams data to read and process.

Top_scams <- read_csv("Data/Top_10Scams_for2019to2020.csv")
Top_scams$Losses <- (as.numeric(gsub('[$,]', '', Top_scams$Losses)))

# Generate and load the stacked bar chart with Highcharter package

Top_scams %>% 
  group_by(Scam_Category, Losses, Year_2020) %>%
  arrange((Losses)) %>%
  summarise( Total_loss = n()) %>%
  arrange(desc(Losses))   %>% 
  hchart(type="bar",
         hcaes(y= Losses,
               x = Scam_Category,
               group = Year_2020),
               color = c( "steelblue", "brown")) %>%
          hc_title(text = "Top SCAMS in Australia for 2019 & 2020") %>%
          hc_yAxis(title = list(text = "Losses from Scams")) %>%
          hc_xAxis(title = list(text = "Top SCAMS costs Millions")) %>%
  hc_plotOptions(bar = list(stacking = "stack")) %>%
  hc_tooltip(shared = TRUE)
 
```


**Data Reference**

* Australian Competition & Consumer Commission (ACCC) publications  on 'Targeting scams: report on scam activity (2020). *'Targeting scams 2019: a review of scam activity since 2009'*. Published on 22 June 2020, Retrieved 14 Aug 2021, from ACCC website: https://www.accc.gov.au/publications/targeting-scams-report-on-scam-activity/targeting-scams-2019-a-review-of-scam-activity-since-2009

* Australian Competition & Consumer Commission (ACCC) publications  on 'Targeting scams: report on scam activity (2020). *'Targeting scams: report of the ACCC on scam activity (2020)'*. Published on 7 June 2021, Retrieved 14 Aug 2021, from ACCC website: https://www.accc.gov.au/publications/targeting-scams-report-on-scam-activity/targeting-scams-report-of-the-accc-on-scam-activity-2020 

* Office of the Australian Information Commissioner (OAIC) report on 'Notifiable data breaches (2019). *'Notifiable Data Breaches scheme 12-month insights report'*. Published on 13 May 2019, Retrieved 14 Aug 2021, from OAIC website: https://www.oaic.gov.au/privacy/notifiable-data-breaches/notifiable-data-breaches-statistics/notifiable-data-breaches-scheme-12month-insights-report/

* Office of the Australian Information Commissioner (OAIC) report on 'Notifiable data breaches (2019). *'Notifiable Data Breaches Statistics Report: 1 April to 30 June 2019'*. Published on 27 August 2019, Retrieved 14 Aug 2021, from OAIC website: https://www.oaic.gov.au/privacy/notifiable-data-breaches/notifiable-data-breaches-statistics/notifiable-data-breaches-statistics-report-1-april-to-30-june-2019/

* Office of the Australian Information Commissioner (OAIC) report on 'Notifiable data breaches (2020). *'Notifiable Data Breaches Report: July-December 2019'*. Published on 28 February 2020, Retrieved 14 Aug 2021, from OAIC website: https://www.oaic.gov.au/privacy/notifiable-data-breaches/notifiable-data-breaches-statistics/notifiable-data-breaches-report-july-december-2019/

* Office of the Australian Information Commissioner (OAIC) report on 'Notifiable data breaches (2020). *'Notifiable Data Breaches Report: January-June 2020'*. Published on 31 July 2020, Retrieved 14 Aug 2021, from OAIC website: https://www.oaic.gov.au/privacy/notifiable-data-breaches/notifiable-data-breaches-statistics/notifiable-data-breaches-report-january-june-2020/

* Office of the Australian Information Commissioner (OAIC) report on 'Notifiable data breaches (2020). *'Notifiable Data Breaches Report: July - December 2020'*. Published on 8 January 2021, Retrieved 14 Aug 2021, from OAIC website: https://www.oaic.gov.au/privacy/notifiable-data-breaches/notifiable-data-breaches-statistics/notifiable-data-breaches-report-july-december-2020/

* Australian Cyber Security Centre (ACSC) Reports and statistics on *'ACSC Annual Cyber Threat Report, July 2019 to June 2020' (2020)*. Published on 03 Sep 2020, Retrieved 14 Aug 2021, from ACSC website: https://www.cyber.gov.au/acsc/view-all-content/reports-and-statistics/acsc-annual-cyber-threat-report-july-2019-june-2020