[R] merging data frame with world map

hoda rahmati hodarahmati68 at yahoo.com
Mon Mar 7 13:21:21 CET 2016


Hi all,I have a data frame which have a column named COUNTRY, I want to merge my data frame with world map from ggmap to plot it on world map, but when I merge my data frame with world map I get 0 observations! Here is my main data frame (mydata): 
    'data.frame':   269265 obs. of  470 variables:
     $ Serial       : num  41568 41568 41568 41568 41568 ...
     $ Duration     : num  218 351 250 200 375 91 236 250 236 322 ...    
     $ COUNTRY      : Factor w/ 27 levels "","AU","BA","BE",..: 8 8 8 8 8 
and here is the command for merging with world map: 
     word_map=merge(world_map,mydata,by.x="region",by.y="country")
     str(world_map)
     'data.frame':   0 obs. of  475 variables:
     $ Serial       : num
     $ Duration     : num  
     $ COUNTRY      : chr
how should I correct this world_map structure to have all my observations? And I could not use rworldmap in R 3.2.3,anyone used this library in version 3.2.3?
Thanks for any help.


	[[alternative HTML version deleted]]



More information about the R-help mailing list