Wednesday, March 18, 2015

How to plot a map using "R"

This is my first attempt of using R. The final intention is to have heat map for certain type of events that occur in Dubai.

To plot a map using R studio, google maps / open street map library is required. To install Google map:
>  install.packages("ggmap")
>  install.packages ("ggplot2")
>  install.packages("maps")

Note: If you want to install into specific file location then:
> install.packages("maps", lib="C:/Users/xxxx/Documents/R/win-library/3.1")

Once these packages are installed, A map of Dubai is obtained with just five lines of R code (including the loading of packages.)

> library("ggplot2")
> library("ggmap")
> library("maps")
> map <- get_map(location = 'Dubai', zoom=11)
Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=Dubai&zoom=11&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false
Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=Dubai&sensor=false
> ggmap(map)



Saturday, January 31, 2015

Cricket World Cup Centuries


  • A total of 127 centuries has been scored in World cup. 
  • On an average 13 centuries have been scored in each world cup. While in the last 3 world cups the average no of centuries is 22.
  • Only 2 centuries were scored in 1979 world cup and both of them were by West Indies.
  • 24 centuries were scored in the 2011 world cup, the most for one single world cup



  • Australia has scored 22 world cup centuries, the most by any team. While New Zealand were at the receiving end allowing teams to score 16 centuries against them
  • Except for 1999 World cup, West Indies has scored century in every World Cup.





Matches involving Pakistan has witnessed 16 centuries, but only 3 were against them



India and Australia has scored a century in every 4 matches played





In 2011 World cup, one century was scored in every second game.The worst ratio is for 1979 world cup: One in every 8 matches played
Sub-Continent has been the best for batsmen, every 2nd match a century has been scored.