Friday, June 7, 2013

Distribution of the six most sighted birds

The folks over at the molecular Ecologist have a instructive tutorial on map making using R. The data from the birders in India, provides a novel dataset to try out these new map making skills. To start of with something simple, we look at the distribution of the 6 most sighted birds across India.

Only 6 species of birds have more than 700 recorded observations. The "Rosy Starling" leads the record with 864 observations followed by "Grey Wagtail" (857), "Common Sandpiper"(787),  "Barn Swallow" (752),"Pied Cuckoo" (750) and "Greenish Warbler" with 710 observations.

 colnames(M)<-c("Species","Location name","City","State","Reporter","Date","Sighting type","Observation frequency","Start date","On behalf of","Latitude","Longitude")  
 kmeans(N, numberofclusters)->P  
 BSwallow<$cluster[M$Species=="Barn Swallow"]))$Freq  
 CSandpiper<$cluster[M$Species=="Common Sandpiper"]))$Freq  
 GWarbler<$cluster[M$Species=="Greenish Warbler"]))$Freq  
 GWagtail<$cluster[M$Species=="Grey Wagtail"]))$Freq  
 PCuckoo<$cluster[M$Species=="Pied Cuckoo"]))$Freq  
 RStarling<$cluster[M$Species=="Rosy Starling"]))$Freq  
 map("worldHires","India",col="gray90", fill=TRUE)  
 for (i in 1:numberofclusters) {  
 add.pie(z=c(BSwallow[i],CSandpiper[i],GWarbler[i],GWagtail[i],PCuckoo[i],RStarling[i]), x=lon[i], y=lat[i], col=c("blue","brown","Green","Grey","black","yellow"), labels="")  
 legend("topright",c("Barn Swallow","Common Sandpiper","Greenish Warbler","Grey Wagtail","Pied Cuckoo","Rosy Starling"),col=c("blue","brown","Green","Grey","black","yellow"),pch="*")  

Running the above code gives a nice(take up the politics with the guys who made the R package) map with pie-charts that looks below image:

The pie-charts are generated for the mean locations that are identified by k-means clustering on all observations with a K of 10. So, this also gives us an idea of where most of the observations come from.

Rosy Starling's are definitely observed more often on the west coast while the Grey Wagtail is seen more often to the south. A large number (337) of the Rosy Starling observations come from Shantilal Varu, whose favorite birds are waders. 


Anonymous said...

Do post pictures of these birds -most sighted in India.

Komal Rathi said...

Wow! I think that was really helpful! I was struggling with plotting pie charts on maps using R. Thanks a lot!!!