#175_Choropleth_map_with_cartography_library_europe #175_Choropleth_map_with_cartography_library

A choropleth map is a map in which areas are shaded or patterned in proportion to the measurement of the statistical variable being displayed on the map. Here is an example using the cartography library. See graph #173 for a hand made version.


Not what you are looking for ? Make a new search !

[mediatagger]


2
Leave a Reply

avatar
1 Comment threads
1 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
2 Comment authors
Gina AChao Huang Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Chao Huang
Guest
Chao Huang

when I test this example,
the code below:
choroLayer(spdf = africa, df = africa@data, var = “POP2005″)
comes an error
” var is not numeric”.
Could you kindly tell me how to solve this problem?
Thank you in advance.

Gina A
Guest
Gina A

I also had the same problem. You need to study the structure of the africa dataset using function glimpse from tidyverse package.
You’ll see that variable POP2005 is a “factor” and not “numeric”.
To fix this, use the function as.numeric as below:

glimpse(africa)
africa$POP2005 <-as.numeric(africa$POP2005)

hope this helps