Commit ddea406170329f00b9399d84e1de27d3fb9da9df

Authored by Imanol-Mikel Barba Sabariego
2 parents 2d7dd7f5 270b040b
ISO27001effectiveness/R/Hackmageddon_Parser.R
... ... @@ -66,9 +66,28 @@ ProcessHMRaw <- function(dataset.raw, dateOffset){
66 66 dataset
67 67 }
68 68  
69   -FilterMultiCountry <- function(dataset) {
70   - multi <- dataset[grepl(" ",Attacks$Country),]
71   - #TODO
  69 +FilterMultiCountry <- function(dataset.pre) {
  70 + multi <- dataset.pre[grepl(" ",dataset.pre$Country),]
  71 +
  72 + dataset <- dataset.pre[!grepl(" ",dataset.pre$Country),]
  73 +
  74 + for (i in 1:nrow(multi)) {
  75 + crow <- multi[i,]
  76 +
  77 + country_s <- strsplit(toString(crow$Country), " ")
  78 +
  79 + for (j in 1:length(country_s)) {
  80 + Date <- crow[1]
  81 + Attack <- crow[2]
  82 + Target <- crow[3]
  83 + Country <- country_s[[1]][j]
  84 + new.row <- data.frame(Date, Attack, Target, Country)
  85 + print(new.row)
  86 + dataset <- rbind(dataset, new.row)
  87 + }
  88 + }
  89 +
  90 + dataset
72 91 }
73 92  
74 93 #' Parse every excel file into a folder
... ...