diff --git a/ISO27001effectiveness/R/ReportGraphs.R b/ISO27001effectiveness/R/ReportGraphs.R index 39c8bc0..0b058ac 100644 --- a/ISO27001effectiveness/R/ReportGraphs.R +++ b/ISO27001effectiveness/R/ReportGraphs.R @@ -1,3 +1,39 @@ +GetBaseCertsGraph <- function(Cert_PerCountry, year){ + 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),], + geom = "col", + fill = Continent) + graph1 +} + +GetAttacksEvolution <- function(Attacks){ + + attacks.range <- Attacks[Attacks$Date < "2016-01-01" & Attacks$Date >= "2012-01-01",] + + attacks.range$Year <- as.numeric(format(attacks.range$Date, "%Y")) + + attacks.range <- mutate(attacks.range, Year = format(attacks.range$Date, "%Y")) %>% group_by(Year) + attacks.range <- as.data.frame(table(attacks.range$Year)) + colnames(attacks.range) <- c("Year","Attacks") + + graph1 <- ggplot2::qplot(main = "Countries with above average number of companies certified with 27001 (2012)", + x = attacks.range$Year, + y = attacks.range$Attacks, + group = 1, + xlab = "Years", + ylab = "Number of attacks", + data = attacks.range, + geom = "line") + geom_point() + geom_smooth( method = lm, se = FALSE) + + graph1 + +} + + #' Return every graph used in the report file #' #' @param Cert_PerCountry data.frame with the processed data of ISO 27001 certifications