Commit 095ddfe011b8ee44d9668e6f9780796876bff707
1 parent
ec03006f
Branch to test graphs implementations
Showing
1 changed file
with
36 additions
and
0 deletions
ISO27001effectiveness/R/ReportGraphs.R
1 | +GetBaseCertsGraph <- function(Cert_PerCountry, year){ | ||
2 | + graph1 <- ggplot2::qplot(main = "Countries with above average number of companies certified with 27001 (2012)", | ||
3 | + x = reorder(country_short,X2012), | ||
4 | + y = X2012, | ||
5 | + xlab = "Country", | ||
6 | + ylab = "Number of certifications", | ||
7 | + data = Cert_PerCountry[Cert_PerCountry$X2012 > mean(Cert_PerCountry$X2012),], | ||
8 | + geom = "col", | ||
9 | + fill = Continent) | ||
10 | + graph1 | ||
11 | +} | ||
12 | + | ||
13 | +GetAttacksEvolution <- function(Attacks){ | ||
14 | + | ||
15 | + attacks.range <- Attacks[Attacks$Date < "2016-01-01" & Attacks$Date >= "2012-01-01",] | ||
16 | + | ||
17 | + attacks.range$Year <- as.numeric(format(attacks.range$Date, "%Y")) | ||
18 | + | ||
19 | + attacks.range <- mutate(attacks.range, Year = format(attacks.range$Date, "%Y")) %>% group_by(Year) | ||
20 | + attacks.range <- as.data.frame(table(attacks.range$Year)) | ||
21 | + colnames(attacks.range) <- c("Year","Attacks") | ||
22 | + | ||
23 | + graph1 <- ggplot2::qplot(main = "Countries with above average number of companies certified with 27001 (2012)", | ||
24 | + x = attacks.range$Year, | ||
25 | + y = attacks.range$Attacks, | ||
26 | + group = 1, | ||
27 | + xlab = "Years", | ||
28 | + ylab = "Number of attacks", | ||
29 | + data = attacks.range, | ||
30 | + geom = "line") + geom_point() + geom_smooth( method = lm, se = FALSE) | ||
31 | + | ||
32 | + graph1 | ||
33 | + | ||
34 | +} | ||
35 | + | ||
36 | + | ||
1 | #' Return every graph used in the report file | 37 | #' Return every graph used in the report file |
2 | #' | 38 | #' |
3 | #' @param Cert_PerCountry data.frame with the processed data of ISO 27001 certifications | 39 | #' @param Cert_PerCountry data.frame with the processed data of ISO 27001 certifications |