#2021 10 27
#Country List
#Ed Lefley

#Run Reorder and clean first

library(stringr)
library(data.table)

Country_List_Ag7 <- (str_split(WoS_Ag7UAddress_All$WoS_Ag7U_REV_RJ, ",", n=Inf, simplify = TRUE))
Country_List_Ag7 <- as.data.frame(Country_List_Ag7)

#Country_List_Ag7_C <- (Country_List_Ag7$V1)
CSC_List_C_Ag7 <- as.data.frame(paste(Country_List_Ag7$V1,Country_List_Ag7$V2,Country_List_Ag7$V3, sep = ","))
#View(Country_List_Ag7_C)
colnames(CSC_List_C_Ag7) <- "CSC"
#View(CSC_List_C)
#Country_List_Ag7_C_NN <- (gsub("[[:digit:]]", "", Country_List_Ag7_C$country))
CSC_C_Ag7_NN <- (sub('.* USA', 'United States', CSC_List_C_Ag7$CSC))
CSC_C_Ag7_NN <- (gsub("  ", " ", CSC_C_Ag7_NN))
#Country_List_Ag7_C_NN <- (gsub(".*USA,", "United States,", Country_List_Ag7_C_NN))
CSC_C_Ag7_NN <- as.vector(CSC_C_Ag7_NN)
CSC_C_Ag7_NN <- as.data.frame(CSC_C_Ag7_NN)
#View(CSC_C_Ag7_NN)
colnames(CSC_C_Ag7_NN) <- "CSC"

CSC_C_Ag7_NN_U <- unique(CSC_C_Ag7_NN)
#View(CSC_C_Ag7_NN_U)

CSC_C_Ag7_NN_U_A <- str_subset(CSC_C_Ag7_NN_U$CSC, "Australia,")
CSC_C_Ag7_NN_U_A <-as.data.frame(CSC_C_Ag7_NN_U_A)
#View(CSC_C_Ag7_NN_U_A)


CSC_C_Ag7_NN_U <- unique(CSC_C_Ag7_NN)
#View(CSC_C_Ag7_NN_U)

CSC_C_Ag7_NN_A <- str_subset(CSC_C_Ag7_NN$CSC, "Australia,")
CSC_C_Ag7_NN_A <-as.data.frame(CSC_C_Ag7_NN_A)
#View(CSC_C_NN_A)
