rworldmaps-R- Cant make it interactive -


my code is:

thecountry <- c("can", "deu", "ita","usa","gbr","fra","jpn") # these iso3 names of countries you'd plot in red  maldf <- data.frame(country = c("can", "deu", "ita","usa","gbr","fra","jpn"),                     sixtyfiveplus = c("16.15%", "21.12%", "22.36%", "14.64%", "18.12%", "18.94%", "26.02%")) # maldf data.frame iso3 country names plus variable # merge map data  malmap <- joincountrydata2map(maldf, joincode = "iso3",                               namejoincolumn = "country") # join maldf data.frame country map data  mapcountrydata(malmap, namecolumntoplot="sixtyfiveplus", catmethod = "categorical",                missingcountrycol = gray(.8), colourpalette = c("seagreen","seagreen1","seagreen2", "seagreen3","chartreuse","chartreuse2","chartreuse4"))  identifycountries(df = "maldf"                   , namecountrycolumn = "malmap"                , namecolumntoplot = "sixtyfiveplus"                   , plotselected = false                   ) 

its giving error : error in identify.default(x = df2[[namex]], y = df2[[namey]], labels = labels, : zero-length 'labels' specified

i have no idea put in x , y since still learning r. me make map interactive give values mentioned in vector?

you close trying plot maldf not spatialpolygonsdataframe. instead should use malmap object:

identifycountries(df = malmap,                   namecountrycolumn = "country",                   namecolumntoplot = "sixtyfiveplus"                   , plotselected = true ) 

which produces: enter image description here


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -