<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/rgbif-seven-years-of-gbif-in-r/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://ropensci.org/technotes/2018/08/22/rgbif-seven-years/"> rOpenSci - open tools for open science</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p><a rel="nofollow" href="https://github.com/ropensci/rgbif" target="_blank">rgbif</a> was seven years old yesterday!</p>

<h2>What is rgbif?</h2>
<p><code>rgbif</code> gives you access to data from the Global Biodiversity Information Facility (<a rel="nofollow" href="https://www.gbif.org/" target="_blank">GBIF</a>) via their API.</p>
<p>A samping of use cases covered in <code>rgbif</code>:</p>
<ul>
<li>Search for datasets</li>
<li>Get metrics on usage of datasets</li>
<li>Get metadata about organizations providing data to GBIF</li>
<li>Search taxonomic names</li>
<li>Get quick taxonomic name suggestions</li>
<li>Search occurrences by taxonomic name/country/collector/etc.</li>
<li>Download occurrences by taxonomic name/country/collector/etc.</li>
<li>Fetch raster maps to quickly visualize large scale biodiversity</li>
</ul>
<p></p>
<h2>History</h2>
<p>Our first commit on <code>rgbif</code> was on <a rel="nofollow" href="https://github.com/ropensci/rgbif/commit/9042246555151240a5136ccf7530d0524bfb1cb5" target="_blank">2011-08-26</a>, uneventfully adding an empty README:</p>
<p><a rel="nofollow" href="https://github.com/ropensci/rgbif/commit/9042246555151240a5136ccf7530d0524bfb1cb5" target="_blank"><img alt="first_commit" src="https://i2.wp.com/ropensci.org/img/blog-images/2018-08-22-rgbif-seven-years/rgbif-first-commit.png?w=456&ssl=1" data-recalc-dims="1"></a></p>
<p>We’ve come a long way since Aug 2011. We’ve added a lot of new functionality and many new contributors.</p>
<p></p>
<h3>Commit history</h3>
<p>Get git commits for <code>rgbif</code> using a few packages as well as <a rel="nofollow" href="https://github.com/ropensci/git2r" target="_blank">git2r</a>, our R package for working with git repositories:</p>
<pre><code>library(git2r)
library(ggplot2)
library(dplyr)

repo &lt;- git2r::repository(&quot;~/github/ropensci/rgbif&quot;)
res &lt;- commits(repo)
</code></pre>
<p>A graph of commit history</p>
<pre><code>dates &lt;- vapply(res, function(z) {
    as.character(as.POSIXct(z$author$when$time, origin = &quot;1970-01-01&quot;))
}, character(1))
df &lt;- tbl_df(data.frame(date = dates, stringsAsFactors = FALSE)) %>% 
    group_by(date) %>%
    summarise(count = n()) %>%
    mutate(cumsum = cumsum(count)) %>%
    ungroup()
ggplot(df, aes(x = as.Date(date), y = cumsum)) +
    geom_line(size = 2) +
    theme_grey(base_size = 16) +
    scale_x_date(labels = scales::date_format(&quot;%Y/%m&quot;)) +
    labs(x = 'August 2011 to August 2018', y = 'Cumulative Git Commits')
</code></pre>
<p><img alt="commits" src="https://i2.wp.com/ropensci.org/img/blog-images/2018-08-22-rgbif-seven-years/commits.png?w=456&ssl=1" data-recalc-dims="1"></p>
<h3>Contributors</h3>
<p>A graph of new contributors through time</p>
<pre><code>date_name &lt;- lapply(res, function(z) {
    data_frame(
        date = as.character(as.POSIXct(z$author$when$time, origin = &quot;1970-01-01&quot;)),
        name = z$author$name
    )
})
date_name &lt;- bind_rows(date_name)

firstdates &lt;- date_name %>%
    group_by(name) %>%
    arrange(date) %>%
    filter(rank(date, ties.method = &quot;first&quot;) == 1) %>%
    ungroup() %>%
    mutate(count = 1) %>%
    arrange(date) %>%
    mutate(cumsum = cumsum(count))

## plot
ggplot(firstdates, aes(as.Date(date), cumsum)) +
  geom_line(size = 2) +
  theme_grey(base_size = 18) +
  scale_x_date(labels = scales::date_format(&quot;%Y/%m&quot;)) +
  labs(x = 'August 2011 to August 2018', y = 'Cumulative New Contributors')
</code></pre>
<p><img alt="contribs" src="https://i0.wp.com/ropensci.org/img/blog-images/2018-08-22-rgbif-seven-years/contribs.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p><code>rgbif</code> contributors, including those that have opened issues (click to go to their GitHub profile):</p>
<p><a rel="nofollow" href="https://github.com/adamdsmith" target="_blank">adamdsmith</a> – <a rel="nofollow" href="https://github.com/AgustinCamacho" target="_blank">AgustinCamacho</a> – <a rel="nofollow" href="https://github.com/AlexPeap" target="_blank">AlexPeap</a> – <a rel="nofollow" href="https://github.com/andzandz11" target="_blank">andzandz11</a> – <a rel="nofollow" href="https://github.com/AugustT" target="_blank">AugustT</a> – <a rel="nofollow" href="https://github.com/benmarwick" target="_blank">benmarwick</a> – <a rel="nofollow" href="https://github.com/cathynewman" target="_blank">cathynewman</a> – <a rel="nofollow" href="https://github.com/cboettig" target="_blank">cboettig</a> – <a rel="nofollow" href="https://github.com/coyotree" target="_blank">coyotree</a> – <a rel="nofollow" href="https://github.com/damianooldoni" target="_blank">damianooldoni</a> – <a rel="nofollow" href="https://github.com/dandaman" target="_blank">dandaman</a> – <a rel="nofollow" href="https://github.com/djokester" target="_blank">djokester</a> – <a rel="nofollow" href="https://github.com/dlebauer" target="_blank">dlebauer</a> – <a rel="nofollow" href="https://github.com/dmcglinn" target="_blank">dmcglinn</a> – <a rel="nofollow" href="https://github.com/dnoesgaard" target="_blank">dnoesgaard</a> – <a rel="nofollow" href="https://github.com/DupontCai" target="_blank">DupontCai</a> – <a rel="nofollow" href="https://github.com/EDiLD" target="_blank">EDiLD</a> – <a rel="nofollow" href="https://github.com/elgabbas" target="_blank">elgabbas</a> – <a rel="nofollow" href="https://github.com/emhart" target="_blank">emhart</a> – <a rel="nofollow" href="https://github.com/fxi" target="_blank">fxi</a> – <a rel="nofollow" href="https://github.com/gkburada" target="_blank">gkburada</a> – <a rel="nofollow" href="https://github.com/hadley" target="_blank">hadley</a> – <a rel="nofollow" href="https://github.com/ibartomeus" target="_blank">ibartomeus</a> – <a rel="nofollow" href="https://github.com/JanLauGe" target="_blank">JanLauGe</a> – <a rel="nofollow" href="https://github.com/jarioksa" target="_blank">jarioksa</a> – <a rel="nofollow" href="https://github.com/jhpoelen" target="_blank">jhpoelen</a> – <a rel="nofollow" href="https://github.com/jkmccarthy" target="_blank">jkmccarthy</a> – <a rel="nofollow" href="https://github.com/johnbaums" target="_blank">johnbaums</a> – <a rel="nofollow" href="https://github.com/jwhalennds" target="_blank">jwhalennds</a> – <a rel="nofollow" href="https://github.com/karthik" target="_blank">karthik</a> – <a rel="nofollow" href="https://github.com/kgturner" target="_blank">kgturner</a> – <a rel="nofollow" href="https://github.com/Kim1801" target="_blank">Kim1801</a> – <a rel="nofollow" href="https://github.com/ljuliusson" target="_blank">ljuliusson</a> – <a rel="nofollow" href="https://github.com/luisDVA" target="_blank">luisDVA</a> – <a rel="nofollow" href="https://github.com/martinpfannkuchen" target="_blank">martinpfannkuchen</a> – <a rel="nofollow" href="https://github.com/MattBlissett" target="_blank">MattBlissett</a> – <a rel="nofollow" href="https://github.com/MattOates" target="_blank">MattOates</a> – <a rel="nofollow" href="https://github.com/maxhenschell" target="_blank">maxhenschell</a> – <a rel="nofollow" href="https://github.com/Pakillo" target="_blank">Pakillo</a> – <a rel="nofollow" href="https://github.com/peterdesmet" target="_blank">peterdesmet</a> – <a rel="nofollow" href="https://github.com/PhillRob" target="_blank">PhillRob</a> – <a rel="nofollow" href="https://github.com/poldham" target="_blank">poldham</a> – <a rel="nofollow" href="https://github.com/qgroom" target="_blank">qgroom</a> – <a rel="nofollow" href="https://github.com/raymondben" target="_blank">raymondben</a> – <a rel="nofollow" href="https://github.com/rossmounce" target="_blank">rossmounce</a> – <a rel="nofollow" href="https://github.com/sacrevert" target="_blank">sacrevert</a> – <a rel="nofollow" href="https://github.com/sckott" target="_blank">sckott</a> – <a rel="nofollow" href="https://github.com/scottsfarley93" target="_blank">scottsfarley93</a> – <a rel="nofollow" href="https://github.com/SriramRamesh" target="_blank">SriramRamesh</a> – <a rel="nofollow" href="https://github.com/steven2249" target="_blank">steven2249</a> – <a rel="nofollow" href="https://github.com/stevenpbachman" target="_blank">stevenpbachman</a> – <a rel="nofollow" href="https://github.com/stevensotelo" target="_blank">stevensotelo</a> – <a rel="nofollow" href="https://github.com/TomaszSuchan" target="_blank">TomaszSuchan</a> – <a rel="nofollow" href="https://github.com/Uzma-165" target="_blank">Uzma-165</a> – <a rel="nofollow" href="https://github.com/vandit15" target="_blank">vandit15</a> – <a rel="nofollow" href="https://github.com/vervis" target="_blank">vervis</a> – <a rel="nofollow" href="https://github.com/vijaybarve" target="_blank">vijaybarve</a> – <a rel="nofollow" href="https://github.com/willgearty" target="_blank">willgearty</a> – <a rel="nofollow" href="https://github.com/zixuan75" target="_blank">zixuan75</a></p>
<p></p>
<h2>rgbif usage</h2>
<p><a rel="nofollow" href="http://www.carlboettiger.info/" target="_blank">Carl Boettiger</a> and I wrote a preprint paper describing <code>rgbif</code> in 2017, in PeerJ Preprints.</p>
<blockquote>
<p>Chamberlain SA, Boettiger C. (2017) R Python, and Ruby clients for GBIF species occurrence data. PeerJ Preprints 5:e3304v1 <a rel="nofollow" href="https://doi.org/10.7287/peerj.preprints.3304v1" target="_blank">https://doi.org/10.7287/peerj.preprints.3304v1</a></p>
</blockquote>
<p>In that paper we also discuss Python (<a rel="nofollow" href="https://pypi.org/project/pygbif" target="_blank">pygbif</a>) and Ruby (<a rel="nofollow" href="https://rubygems.org/gems/gbifrb" target="_blank">gbifrb</a>) GBIF clients. Check those out if you also sling Python or Ruby.</p>
<p>The paper above and/or the package have been cited <strong>56</strong> times over the past 7 years.</p>
<p>The way <code>rgbif</code> is used in research is most often in download occurrence data for a set of study species.</p>
<p>One example comes from the paper</p>
<blockquote>
<p>Carvajal-Endara, S., Hendry, A. P., Emery, N. C., &amp; Davies, T. J. (2017). Habitat filtering not dispersal limitation shapes oceanic island floras: species assembly of the Galápagos archipelago. Ecology Letters, 20(4), 495 - 504. <a rel="nofollow" href="https://doi.org/10.1111/ele.12753" target="_blank">https://doi.org/10.1111/ele.12753</a></p>
</blockquote>
<div>
<a rel="nofollow" href="https://doi.org/10.1111/ele.12753" target="_blank"><img title="Carvajal-Endara et al." src="https://i2.wp.com/ropensci.org/img/blog-images/2018-08-22-rgbif-seven-years/rgbif-methods.png?w=450&ssl=1" data-recalc-dims="1"></a>
</div>

<p>In another example (note the mention of removing certain records based on GBIF flags, check out <code>rgbif::occ_issues</code> to learn more)</p>
<blockquote>
<p>Werner, G. D. A., Cornwell, W. K., Cornelissen, J. H. C., &amp; Kiers, E. T. (2015). Evolutionary signals of symbiotic persistence in the legume - rhizobia mutualism. Proc Natl Acad Sci USA, 112(33), 10262 - 10269. <a rel="nofollow" href="https://doi.org/10.1073/pnas.1424030112" target="_blank">https://doi.org/10.1073/pnas.1424030112</a></p>
</blockquote>
<div>
<a rel="nofollow" href="https://doi.org/10.1073/pnas.1424030112" target="_blank"><img title="Werner et al." src="https://i2.wp.com/ropensci.org/img/blog-images/2018-08-22-rgbif-seven-years/rgbif-methods2.png?w=450&ssl=1" data-recalc-dims="1"></a>
</div>
<p></p>
<h2>Some features coming down the road</h2>
<ul>
<li>Fully automated pagination across the package. Some functions have automated pagination (<code>occ_search</code>/<code>occ_data</code>/all <code>name_</code> functions). So users don’t have to do manual pagination.</li>
<li>Improved <code>map_fetch()</code> function. We just released this function in the last version, but it’s still early days and needs to improve a lot based on your feedback</li>
<li>Improved occurrence downloading queue: we rolled this out recently but just like <code>map_fetch</code> it’s in its early days and definitely has many rough edges. Please let us know what you think!</li>
</ul>
<p></p>
<h2>Thanks!</h2>
<p>We all owe a large debt of gratitude to <a rel="nofollow" href="https://www.gbif.org/" target="_blank">GBIF</a> for making an awesome resource for all those using their data, and to all the organizations/people that contribute data to GBIF.</p>
<p>A huge thanks goes to all <code>rgbif</code> users and contributors! It’s great to see how useful <code>rgbif</code> has been through the years, and we look forward to making it even better moving forward.</p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://ropensci.org/technotes/2018/08/22/rgbif-seven-years/"> rOpenSci - open tools for open science</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/tfNjJb2ZKy0" height="1"></a></div>