library(rworldmap)
## Loading required package: sp
## ### Welcome to rworldmap ###
## For a short introduction type :   vignette('rworldmap')
library(countrycode)

挑出幾個國家名稱放進資料,並以iso3c編碼

dta <- read.table("country.txt", h = T)
dta$Country <- countrycode(dta[,1], "country.name", "iso3c")
dta$random <- rep(1, length(dta$Country))
head(dta)
##   Country random
## 1     LVA      1
## 2     MDV      1
## 3     NIU      1
## 4     QAT      1
## 5     SDN      1
## 6     YEM      1

將挑出的國家進行繪圖

mapDevice("x11")
countryMap <- joinCountryData2Map(dta, joinCode = "ISO3", nameJoinColumn = "Country")
## 10 codes from your data successfully matched countries in the map
## 0 codes from your data failed to match with a country code in the map
## 233 codes from the map weren't represented in your data
mapCountryData(countryMap, nameColumnToPlot = "random",
               catMethod = "categorical",
               addLegend = FALSE, mapTitle ="Plot Country", 
               missingCountryCol = gray(.6))