diff --git a/ISO27001effectiveness/R/Hackmageddon_Parser.R b/ISO27001effectiveness/R/Hackmageddon_Parser.R index c407e7b..c0a3bd8 100644 --- a/ISO27001effectiveness/R/Hackmageddon_Parser.R +++ b/ISO27001effectiveness/R/Hackmageddon_Parser.R @@ -66,9 +66,28 @@ ProcessHMRaw <- function(dataset.raw, dateOffset){ dataset } -FilterMultiCountry <- function(dataset) { - multi <- dataset[grepl(" ",Attacks$Country),] - #TODO +FilterMultiCountry <- function(dataset.pre) { + multi <- dataset.pre[grepl(" ",dataset.pre$Country),] + + dataset <- dataset.pre[!grepl(" ",dataset.pre$Country),] + + for (i in 1:nrow(multi)) { + crow <- multi[i,] + + country_s <- strsplit(toString(crow$Country), " ") + + for (j in 1:length(country_s)) { + Date <- crow[1] + Attack <- crow[2] + Target <- crow[3] + Country <- country_s[[1]][j] + new.row <- data.frame(Date, Attack, Target, Country) + print(new.row) + dataset <- rbind(dataset, new.row) + } + } + + dataset } #' Parse every excel file into a folder