[code language=”R”]
data = read.csv(‘flag_data.csv’, header = T, stringsAsFactors = F)
gsub(‘Asia’,5,data$landmass, fixed = TRUE)
data$landmass = gsub(‘Asia’,5, data$landmass, fixed = TRUE)
gsub(‘N.America’,1,data$landmass, fixed = TRUE)
data$landmass = gsub(‘N.America’,1, data$landmass, fixed = TRUE)
gsub(‘S.America’,2,data$landmass, fixed = TRUE)
data$landmass = gsub(‘S.America’,2, data$landmass, fixed = TRUE)
gsub(‘Europe’,3,data$landmass, fixed = TRUE)
data$landmass = gsub(‘Europe’,3, data$landmass, fixed = TRUE)
gsub(‘Africa’,4,data$landmass, fixed = TRUE)
data$landmass = gsub(‘Africa’,4, data$landmass, fixed = TRUE)
gsub(‘Oceania’,6,data$landmass, fixed = TRUE)
data$landmass = gsub(‘Oceania’,6, data$landmass, fixed = TRUE)
grep(‘5’,data$landmass,fixed = TRUE)
grep(‘Puerto-Rico’,data$name, fixed = TRUE)
guess = data[141,]
guess
grep(‘Hong-Kong’,data$name)
grep(‘-‘,data$name)
[/code]