Page 273 - Data Science class 11
P. 273

"WestIndies",
                       "India",

                       "SriLanka",
                       "Pakistan",

                       "Bangladesh",
                       "NewZealand",
                       "SouthAfrica",
                       "England",

                       "HongKong",
                       "Zimbabwe",

                       "Afghanistan",
                       "Scotland",
                       "Netherlands",
                       "Ireland",

                       "Oman")

                #extract geo location of these countries
                > countries <- geocode(ICC_WC_T20)
                #map longitude and latitude in separate variables
                > nation.x <- countries$lon

                > nation.y <- countries$lat
                #using ggplot
                #plot the world map
                > mapWorld <- borders("world", colour="grey", fill="lightblue")
                #add data points to the world map

                > ggplot() + mapWorld + geom_point(aes(x=visit.x, y=visit.y),color="red", size=3)






















                                               geographical map using ggplot in R

            You can still embellish this map. If you are not familiar with the world map, it would be difficult for you to identify
            countries' names. Let’s use functions from the ggmap () package to redesign this map.




                                                           Coding for Data Science Visualisation using R-Studio  271
   268   269   270   271   272   273   274   275   276   277   278