rinat
R wrapper for iNaturalist APIs for accessing the observations.
https://github.com/ropensci/rinat
Category: Biosphere
Sub Category: Biodiversity Data Access and Management
Keywords
inaturalist r r-package rstats spocc
Keywords from Contributors
routes cycle biology biodiversity gbif species oscibio lifewatch taxonomy taxize
Last synced: about 13 hours ago
JSON representation
Repository metadata
A programmatic interface to iNaturalist
- Host: GitHub
- URL: https://github.com/ropensci/rinat
- Owner: ropensci
- License: other
- Created: 2013-10-03T19:26:27.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2025-08-30T16:29:07.000Z (8 months ago)
- Last Synced: 2026-03-30T05:48:20.633Z (14 days ago)
- Topics: inaturalist, r, r-package, rstats, spocc
- Language: R
- Homepage: https://docs.ropensci.org/rinat
- Size: 4.82 MB
- Stars: 67
- Watchers: 10
- Forks: 19
- Open Issues: 14
- Releases: 6
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- License: LICENSE
README.Rmd
---
title: "rinat: Access iNaturalist data with R"
author: Edmund Hart, Stéphane Guillou
output: github_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, warning = FALSE)
```
[](https://ci.appveyor.com/project/sckott/rinat/branch/master)
[](https://CRAN.R-project.org/package=rinat)
R wrapper for iNaturalist APIs for accessing the observations. The detailed documentation of the API is available on the [iNaturalist website](https://www.inaturalist.org/pages/api+reference) and is part of our larger species occurrence searching packages [SPOCC](https://github.com/ropensci/spocc).
## Installation
You can install the latest version available on CRAN with:
```{r eval=FALSE}
install.packages("rinat")
```
Alternatively, you can install the development version from Github with:
```{r eval=FALSE}
remotes::install_github("ropensci/rinat")
```
## Usage
### Get observations
`get_inat_obs()` is the primary function that retrieves observations from iNaturalist. The text or taxon search can be refined by observation date, record quality and location.
> It is recommended to set the `quality` argument to `"research"` in order to get more reliable data that has been validated by several contributors.
#### Taxon search
To return only records of a specific species or taxonomic group, use the `taxon_name` argument. For example, to return observations of anything from the Nymphalidae family, and restricting the search to the year 2015:
```{r}
library(rinat)
nymphalidae <- get_inat_obs(taxon_name = "Nymphalidae", year = 2015)
# how many unique taxa?
length(unique(nymphalidae$scientific_name))
```
> Note that `get_inat_obs()` will return 100 observations by default. This can be controlled with the `maxresults` argument.
#### Text search
You can also search observations with any string. It will search the entire iNaturalist database, so the search below will return all entries that _mention_ Monarch butterflies, not just Monarch observations.
```{r}
monarchs <- get_inat_obs(query = "Monarch Butterfly", year = 2021)
# which taxa were returned?
unique(monarchs$scientific_name)
```
You can combine the fuzzy search with the precise taxon search. For example, to get Monarch butterfly observations that also mention the term "chrysalis":
```{r}
monarch_chrysalis <- get_inat_obs(taxon_name = "Danaus plexippus", query = "chrysalis")
```
#### Bounding box search
You can also search within a bounding box by giving a simple set of coordinates.
```{r}
## Search by area
bounds <- c(38.44047, -125, 40.86652, -121.837)
deer <- get_inat_obs(query = "Mule Deer", bounds = bounds)
plot(deer$longitude, deer$latitude)
```
### Other functions
More functions are available, notably to access:
* observations in a project with `get_inat_obs_project()`
* details of a single observation with `get_inat_obs_id()`
* observations from a single user with `get_inat_obs_user()`
* taxa statistics with `get_inat_taxon_stats()`
* user statistics with `get_inat_user_stats()`
More detailed examples are included in the vignette:
```{r eval=FALSE}
vignette("rinat-intro", package = "rinat")
```
#### Mapping
Basic maps can be created with the `inat_map()` function to quickly visualize search results. The `plot = FALSE` option can be used to avoid displaying the initial plot when further customising it with ggplot2 functions.
```{r fig.width=7, fig.height=4, fig.retina=3}
library(ggplot2)
## Map 100 spotted salamanders
a_mac <- get_inat_obs(taxon_name = "Ambystoma maculatum", year = 2021)
salamander_map <- inat_map(a_mac, plot = FALSE)
### Further customise the returned ggplot object
salamander_map + borders("state") + theme_bw()
```
`inat_map()` is useful for quickly mapping single-species data obtained with rinat. However, more complicated plots are best made from scratch. Here is an example of customised map that does not make use of it. (Note the use of `quality = "research"` to restrict the search to the more reliable observations.)
```{r fig.width=7, fig.height=7, fig.retina=3}
## A more elaborate map of Colibri sp.
colibri <- get_inat_obs(taxon_name = "Colibri",
quality = "research",
maxresults = 500)
ggplot(data = colibri, aes(x = longitude,
y = latitude,
colour = scientific_name)) +
geom_polygon(data = map_data("world"),
aes(x = long, y = lat, group = group),
fill = "grey95",
color = "gray40",
size = 0.1) +
geom_point(size = 0.7, alpha = 0.5) +
coord_fixed(xlim = range(colibri$longitude, na.rm = TRUE),
ylim = range(colibri$latitude, na.rm = TRUE)) +
theme_bw()
```
---
[](https://ropensci.org/)
Owner metadata
- Name: rOpenSci
- Login: ropensci
- Email: info@ropensci.org
- Kind: organization
- Description:
- Website: https://ropensci.org/
- Location: Berkeley, CA
- Twitter: rOpenSci
- Company:
- Icon url: https://avatars.githubusercontent.com/u/1200269?v=4
- Repositories: 307
- Last ynced at: 2023-03-10T20:30:59.242Z
- Profile URL: https://github.com/ropensci
GitHub Events
Total
- Release event: 1
- Pull request event: 1
- Issues event: 2
- Watch event: 9
- Issue comment event: 6
- Push event: 4
Last Year
- Release event: 1
- Pull request event: 1
- Watch event: 4
- Issue comment event: 2
- Push event: 4
Committers metadata
Last synced: 4 days ago
Total Commits: 158
Total Committers: 12
Avg Commits per committer: 13.167
Development Distribution Score (DDS): 0.601
Commits in past year: 8
Committers in past year: 2
Avg Commits per committer in past year: 4.0
Development Distribution Score (DDS) in past year: 0.125
| Name | Commits | |
|---|---|---|
| Stéphane Guillou | s****u@m****g | 63 |
| Edmund Hart | e****t@g****m | 38 |
| LDalby | l****y@g****m | 19 |
| Scott Chamberlain | m****s@g****m | 17 |
| VijayBarve | v****e@r****m | 6 |
| Edmund Hart | e****t@E****l | 5 |
| steven2249 | s****w@b****u | 3 |
| Martin-Jung | m****g@z****m | 3 |
| beausoleilmo | b****o@g****m | 1 |
| Maëlle Salmon | m****n@y****e | 1 |
| Karthik Ram | k****m@g****m | 1 |
| Jeroen Ooms | j****s@g****m | 1 |
Committer domains:
- zoho.com: 1
- berkeley.edu: 1
- rediffmail.com: 1
- member.fsf.org: 1
Issue and Pull Request metadata
Last synced: 22 days ago
Total issues: 48
Total pull requests: 15
Average time to close issues: 6 months
Average time to close pull requests: 3 months
Total issue authors: 28
Total pull request authors: 9
Average comments per issue: 2.35
Average comments per pull request: 0.73
Merged pull request: 11
Bot issues: 0
Bot pull requests: 0
Past year issues: 1
Past year pull requests: 2
Past year average time to close issues: N/A
Past year average time to close pull requests: 16 days
Past year issue authors: 1
Past year pull request authors: 2
Past year average comments per issue: 0.0
Past year average comments per pull request: 0.0
Past year merged pull request: 1
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- sckott (8)
- emhart (6)
- stragu (6)
- philippi (2)
- LDalby (2)
- vijaybarve (2)
- sgdrewry (1)
- lbourgeaud (1)
- Martin-Jung (1)
- Cactusolo (1)
- fischhoff (1)
- bomeara (1)
- bjornekstrom (1)
- TlaskalV (1)
- ZekeMarshall (1)
Top Pull Request Authors
- LDalby (5)
- Rishi0812 (2)
- vijaybarve (2)
- maelle (1)
- sastoudt (1)
- Martin-Jung (1)
- abichat (1)
- beausoleilmo (1)
- stevenysw (1)
Top Issue Labels
- bug (3)
- enhancement (2)
- good first issue (1)
- API v1 (1)
- high priority (1)
Top Pull Request Labels
Dependencies
- curl * imports
- ggplot2 * imports
- httr * imports
- jsonlite * imports
- maps * imports
- plyr * imports
- sp * imports
- dplyr * suggests
- ggforce * suggests
- knitr * suggests
- lubridate * suggests
- purrr * suggests
- rmarkdown * suggests
- sf * suggests
- stringr * suggests
- testthat * suggests
Score: 6.87935580446044