diff --git a/p2/df_consolidation.R b/p2/df_consolidation.R index e9329a1..4c9fa4c 100644 --- a/p2/df_consolidation.R +++ b/p2/df_consolidation.R @@ -11,11 +11,13 @@ library(dplyr) gerrit_extracted_df <- gerrit_df |> mutate( - jsonfixed = gsub("(?<=\\{|\\[|, )'(\\w+?)'(?=\\s*:)", '"\\1"', selected_gerrit_results, perl = TRUE), - jsonfixed = gsub(":(\\s*)'(.*?)'(?=[}\\],])", ':\\1"\\2"', jsonfixed, perl = TRUE), - jsonfixed = gsub("(?<=[:\\[,\\{])\\s*'([^']*)'\\s*(?=[,\\}\\]])", '"\\1"', jsonfixed, perl = TRUE), - expandedjsonlist = lapply(jsonfixed, fromJSON) - ) + gerrit_status = str_match(selected_gerrit_results, "'status':\\s*'([^']*)',\\s*'reviewer")[,2], + owner_email = str_match(selected_gerrit_results, "'owner_email':\\s*'([^']*)'")[,2], + written_url_in_message = str_match(selected_gerrit_results, "'written_url_in_message':\\s*'([^']*)'")[,2], + code_insertions = as.integer(str_match(selected_gerrit_results, "'code_insertions':\\s*(\\d+)")[,2]), + code_deletions = as.integer(str_match(selected_gerrit_results, "'code_deletions':\\s*(\\d+)")[,2]), + reviewer_count = as.integer(str_match(selected_gerrit_results, "'reviewer_count':\\s*(\\d+)")[,2]) + ) # TODO select # gerrit status: categorical