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]]
Inline On 07/03/2016 12:21, hoda rahmati via R-help wrote:> 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 8COUNTRY> and here is the command for merging with world map: > word_map=merge(world_map,mydata,by.x="region",by.y="country")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]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Michael http://www.dewey.myzen.co.uk/home.html
And more! :-) On Mar 7, 2016, at 8:15 AM, Michael Dewey <lists at dewey.myzen.co.uk> wrote:> Inline > > On 07/03/2016 12:21, hoda rahmati via R-help wrote: >> 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 > > COUNTRY > >> and here is the command for merging with world map: >> word_map=merge(world_map,mydata,by.x="region",by.y="country")word_map> > country > >> str(world_map)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]] >> >> ______________________________________________ >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > -- > Michael > http://www.dewey.myzen.co.uk/home.html > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.