(This article was first published on

**Vijay Barve**, and kindly contributed to R-bloggers)iNaturalist projects are collection of records posted on iNatualist. Now that we have a R package rinat from rOpenSci I thought of playing around with the data. Here is a function I wrote, to quickly map all the records of a project using ggmap package.

library(ggmap) library(rinat) inatmap <- function(grpid){ data1=get_inat_obs_project(grpid, type = "observations") data1=data1[which(!is.na(data1$Latitude)),] map <-get_map(location =c(min(data1$Longitude), min(data1$Latitude), max(data1$Longitude), max(data1$Latitude)), messaging = FALSE) p <-ggplot() p= ggmap(map)+geom_point(data=data1, aes(x=as.numeric(Longitude), y=as.numeric(Latitude))) p }

We can used `get_inat_obs_project`

function from **rinat** package to get all the observation from the specified project. `get_map`

function form **ggmap** package to download google maps base layer and `ggplot`

function form **ggplot2** package to actually plot the map with points.

Now call to the function with a group name will produce a map with all the records in the project.

inatmap("birdindia")

We can use other ggplot options to add title, legend etc. to the map. This is just a simple example.

To

**leave a comment**for the author, please follow the link and comment on his blog:**Vijay Barve**.R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...