diff --git a/ISO27001effectiveness/R/Hackmageddon_Parser.R b/ISO27001effectiveness/R/Hackmageddon_Parser.R index 9149bac..e0afb8c 100644 --- a/ISO27001effectiveness/R/Hackmageddon_Parser.R +++ b/ISO27001effectiveness/R/Hackmageddon_Parser.R @@ -74,6 +74,10 @@ ProcessHMRaw <- function(dataset.raw, dateOffset){ dataset$Country <- gsub("UAE","AE",dataset$Country) dataset$Country <- gsub("CB","KH",dataset$Country) + CountryNames <- data.frame(countrycode::countrycode_data$country.name, countrycode::countrycode_data$iso2c, countrycode::countrycode_data$continent) + CountryNames <- setNames(CountryNames, c("Country_large","Country", "Continent")) + dataset <- merge(x = dataset, y = CountryNames, by = "Country", all.x = TRUE) + dataset <- dataset[!is.na(dataset$Continent),] #Format properly the date dataset$Date <- as.POSIXct(dataset$Date*86400, tz = "GMT", origin = dateOffset) diff --git a/ISO27001effectiveness/R/ISOSurvey_Parser.R b/ISO27001effectiveness/R/ISOSurvey_Parser.R index 92da800..09712cb 100644 --- a/ISO27001effectiveness/R/ISOSurvey_Parser.R +++ b/ISO27001effectiveness/R/ISOSurvey_Parser.R @@ -96,10 +96,12 @@ ProccesISOSurveyByCountryRaw <- function(dataset.raw, years){ #Translate country names to 2 letter code - CountryNames <- data.frame(countrycode::countrycode_data$country.name, countrycode::countrycode_data$iso2c) - CountryNames <- setNames(CountryNames, c("Country","country_short")) + CountryNames <- data.frame(countrycode::countrycode_data$country.name, countrycode::countrycode_data$iso2c, countrycode::countrycode_data$continent) + CountryNames <- setNames(CountryNames, c("Country","country_short", "Continent")) dataset <- merge(x = dataset, y = CountryNames, by = "Country", all.x = TRUE) + dataset <- dataset[!is.na(dataset$Continent),] + dataset } diff --git a/ISO27001effectiveness/R/ReportGraphs.R b/ISO27001effectiveness/R/ReportGraphs.R index 2caab8a..39c8bc0 100644 --- a/ISO27001effectiveness/R/ReportGraphs.R +++ b/ISO27001effectiveness/R/ReportGraphs.R @@ -7,12 +7,15 @@ #' @export GetReportGraphs <- function(Cert_PerCountry,Attacks) { #2012 - graph1 <- ggplot2::qplot(main = "Countries with above average number of companies certified with ISO 27001 (2012)", + graph1 <- ggplot2::qplot(main = "Countries with above average number of companies certified with 27001 (2012)", x = reorder(country_short,X2012), y = X2012, xlab = "Country", ylab = "Number of certifications", - data = Cert_PerCountry[Cert_PerCountry$X2012 > mean(Cert_PerCountry$X2012),]) + data = Cert_PerCountry[Cert_PerCountry$X2012 > mean(Cert_PerCountry$X2012),], + geom = "col", + fill = Continent) + attacks2k12 <- Attacks[Attacks$Date < "2013-01-01" & Attacks$Date >= "2012-01-01",] frameAttacks2k12 <- as.data.frame(table(attacks2k12$Country)) colnames(frameAttacks2k12) <- c("Country","Attacks") @@ -21,7 +24,9 @@ GetReportGraphs <- function(Cert_PerCountry,Attacks) { y = Attacks, xlab = "Country", ylab = "Number of attacks", - data = frameAttacks2k12[frameAttacks2k12$Attacks > mean(frameAttacks2k12$Attacks),]) + data = frameAttacks2k12[frameAttacks2k12$Attacks > mean(frameAttacks2k12$Attacks),], + geom = "col", + fill = Continent) Attacks2012ByMonth <- mutate(attacks2k12, month = format(attacks2k12$Date, "%m")) %>% group_by(month) Attack2012FreqByMonth <- as.data.frame(table(Attacks2012ByMonth$month)) @@ -35,12 +40,14 @@ GetReportGraphs <- function(Cert_PerCountry,Attacks) { xlab = "Month") + ggplot2::scale_x_continuous(breaks = 1:12) #2013 - graph4 <- ggplot2::qplot(main = "Countries with above average number of companies certified with ISO 27001 (2013)", + graph4 <- ggplot2::qplot(main = "Countries with above average number of companies certified with 27001 (2013)", x = reorder(country_short,X2013), y = X2013, xlab = "Country", ylab = "Number of certifications", - data = Cert_PerCountry[Cert_PerCountry$X2013 > mean(Cert_PerCountry$X2013),]) + data = Cert_PerCountry[Cert_PerCountry$X2013 > mean(Cert_PerCountry$X2013),] + , geom = "col", + fill = Continent) attacks2k13 <- Attacks[Attacks$Date < "2014-01-01" & Attacks$Date >= "2013-01-01",] frameAttacks2k13 <- as.data.frame(table(attacks2k13$Country)) colnames(frameAttacks2k13) <- c("Country","Attacks") @@ -49,7 +56,9 @@ GetReportGraphs <- function(Cert_PerCountry,Attacks) { y = Attacks, xlab = "Country", ylab = "Number of attacks", - data = frameAttacks2k13[frameAttacks2k13$Attacks > mean(frameAttacks2k13$Attacks),]) + data = frameAttacks2k13[frameAttacks2k13$Attacks > mean(frameAttacks2k13$Attacks),] + , geom = "col", + fill = Continent) Attacks2013ByMonth <- mutate(attacks2k13, month = format(attacks2k13$Date, "%m")) %>% group_by(month) Attack2013FreqByMonth <- as.data.frame(table(Attacks2013ByMonth$month)) @@ -63,12 +72,14 @@ GetReportGraphs <- function(Cert_PerCountry,Attacks) { xlab = "Month") + ggplot2::scale_x_continuous(breaks = 1:12) #2014 - graph7 <- ggplot2::qplot(main = "Countries with above average number of companies certified with ISO 27001 (2014)", + graph7 <- ggplot2::qplot(main = "Countries with above average number of companies certified with 27001 (2014)", x = reorder(country_short,X2014), y = X2014, xlab = "Country", ylab = "Number of certifications", - data = Cert_PerCountry[Cert_PerCountry$X2014 > mean(Cert_PerCountry$X2014),]) + data = Cert_PerCountry[Cert_PerCountry$X2014 > mean(Cert_PerCountry$X2014),] + , geom = "col", + fill = Continent) attacks2k14 <- Attacks[Attacks$Date < "2015-01-01" & Attacks$Date >= "2014-01-01",] frameAttacks2k14 <- as.data.frame(table(attacks2k14$Country)) colnames(frameAttacks2k14) <- c("Country","Attacks") @@ -77,7 +88,9 @@ GetReportGraphs <- function(Cert_PerCountry,Attacks) { y = Attacks, xlab = "Country", ylab = "Number of attacks", - data = frameAttacks2k14[frameAttacks2k14$Attacks > mean(frameAttacks2k14$Attacks),]) + data = frameAttacks2k14[frameAttacks2k14$Attacks > mean(frameAttacks2k14$Attacks),] + , geom = "col", + fill = Continent) Attacks2014ByMonth <- mutate(attacks2k14, month = format(attacks2k14$Date, "%m")) %>% group_by(month) Attack2014FreqByMonth <- as.data.frame(table(Attacks2014ByMonth$month)) @@ -91,12 +104,14 @@ GetReportGraphs <- function(Cert_PerCountry,Attacks) { xlab = "Month") + ggplot2::scale_x_continuous(breaks = 1:12) #2015 - graph10 <- ggplot2::qplot(main = "Countries with above average number of companies certified with ISO 27001 (2015)", + graph10 <- ggplot2::qplot(main = "Countries with above average number of companies certified with 27001 (2015)", x = reorder(country_short,X2015), y = X2015, xlab = "Country", ylab = "Number of certifications", - data = Cert_PerCountry[Cert_PerCountry$X2015 > mean(Cert_PerCountry$X2015),]) + data = Cert_PerCountry[Cert_PerCountry$X2015 > mean(Cert_PerCountry$X2015),] + , geom = "col", + fill = Continent) attacks2k15 <- Attacks[Attacks$Date < "2016-01-01" & Attacks$Date >= "2015-01-01",] frameAttacks2k15 <- as.data.frame(table(attacks2k15$Country)) colnames(frameAttacks2k15) <- c("Country","Attacks") @@ -105,7 +120,9 @@ GetReportGraphs <- function(Cert_PerCountry,Attacks) { y = Attacks, xlab = "Country", ylab = "Number of attacks", - data = frameAttacks2k15[frameAttacks2k15$Attacks > mean(frameAttacks2k15$Attacks),]) + data = frameAttacks2k15[frameAttacks2k15$Attacks > mean(frameAttacks2k15$Attacks),] + , geom = "col", + fill = Continent) Attacks2015ByMonth <- mutate(attacks2k15, month = format(attacks2k15$Date, "%m")) %>% group_by(month) Attack2015FreqByMonth <- as.data.frame(table(Attacks2015ByMonth$month)) diff --git a/ISO27001effectiveness/Report.Rmd b/ISO27001effectiveness/Report.Rmd index 0c7683e..70bc41c 100644 --- a/ISO27001effectiveness/Report.Rmd +++ b/ISO27001effectiveness/Report.Rmd @@ -1,9 +1,11 @@ --- title: "ISO 27001 Effectiveness" -output: html_document +output: + html_document: default + pdf_document: default --- -```{r setup, include=FALSE} +```{r setup, include=TRUE} knitr::opts_chunk$set(echo = TRUE) library(ISO27001effectiveness) library(xlsx) diff --git a/ISO27001effectiveness/Report.html b/ISO27001effectiveness/Report.html index a57db60..6df7420 100644 --- a/ISO27001effectiveness/Report.html +++ b/ISO27001effectiveness/Report.html @@ -120,6 +120,32 @@ $(document).ready(function () { +
knitr::opts_chunk$set(echo = TRUE)
+library(ISO27001effectiveness)
+library(xlsx)
+## Loading required package: rJava
+## Loading required package: xlsxjars
+library(ggplot2)
+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
+library(countrycode)
+
+source("./Main.R")
+## Scale for 'x' is already present. Adding another scale for 'x', which
+## will replace the existing scale.
+## Scale for 'x' is already present. Adding another scale for 'x', which
+## will replace the existing scale.
+## Scale for 'x' is already present. Adding another scale for 'x', which
+## will replace the existing scale.
+## Scale for 'x' is already present. Adding another scale for 'x', which
+## will replace the existing scale.
La creciente preocupación de muchas empresas con infraestructura IT crítica frente a ciberataques ha llevado a algunas de ellas a tomar medidas de seguridad como la creación de departamentos de Seguridad de la Información, llevar a cabo auditorías de seguridad y obtener certificaciones de seguridad entre otras.