#Cleaning Duplicates
#2021 02 14
#Ed Lefley
  
##Convert Convert Addresses to matrix then vector, based on https://www.tutorialspoint.com/how-to-convert-columns-of-an-r-data-frame-into-a-single-vector 
  
#WoS2017_vector <- as.vector(as.matrix(WoS_2017Addresses))
  
#Remove duplicates (empty rows & repeats of identical affiliation associations)
#WoS2017_vector_u <- unique(WoS2017_vector)
#View(WoS2017_vector_u)

##Packages needed
library(stringr)
library(data.table)

WoS_Ag7 <- (as.vector(as.matrix(Ag7_Addresses))) 
WoS_Ag7 <- unlist(strsplit(WoS_Ag7,";"))
WoS_Ag7 <- as.matrix(WoS_Ag7)
WoS_Ag7 <- trimws(WoS_Ag7,"both")

WoS_Ag7U <- as.data.frame(unique(WoS_Ag7))
WoS_Ag7U_D <- str_split(WoS_Ag7U$V1, ",",n=Inf, simplify = TRUE)

WoS_Ag7 <- as.data.frame(WoS_Ag7)
WoS_Ag7_D <- str_split(WoS_Ag7$V1, ",",n=Inf, simplify = TRUE)
