# iNaturalist User Trends with R

**URL:** <https://forum.inaturalist.org/t/inaturalist-user-trends-with-r/12538>\
**Category:** General\
**Tags:** third-party-tools\
**Created:** [May 19, 2020, 2:01pm UTC](https://forum.inaturalist.org/t/inaturalist-user-trends-with-r/12538 "2020-05-19T14:01:12Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![jlayman](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.inaturalist.org/jlayman/32/566_2.png) [@jlayman](https://forum.inaturalist.org/u/jlayman)\
**Post date:** [May 19, 2020, 2:01pm UTC](https://forum.inaturalist.org/t/inaturalist-user-trends-with-r/12538/1 "2020-05-19T14:01:12Z")

</div>

Hello fellow iNatters!

I’m just finishing up a Data Science for Biology course at UMASS Boston, and as the final project had to make an interactive web app with R. I ended up creating an app that, given an iNaturalist username, downloads the users observation data set and generates a number of visualizations, tables, and maps regarding their usage of iNat. The app has really been a hit among the iNat users on UMASS Boston’s Biology faculty, so I thought I share it with the community. Enjoy!

The app: [https://jonathanlayman001.shinyapps.io/iNaturalist\_user\_trends/](https://jonathanlayman001.shinyapps.io/iNaturalist_user_trends/)

P.S. may take a few minutes to load the visualizations depending on how many observations a user has. I also put a cap at 10,000 observations for performance, so if you have more than that this only uses your last 10k.

Jonathan Layman  
Medford, Massachusetts  
UMASS Boston Biology class of 2020

---

<div class="post-metadata">

**Author:** ![whimbrelbirder](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.inaturalist.org/whimbrelbirder/32/1833_2.png) [@whimbrelbirder](https://forum.inaturalist.org/u/whimbrelbirder)\
**Post date:** [May 19, 2020, 2:38pm UTC](https://forum.inaturalist.org/t/inaturalist-user-trends-with-r/12538/3 "2020-05-19T14:38:41Z")

</div>

Oops, accidentally deleted. Just was saying, that it is very cool and thanks for sharing! One problem though, I keep getting an error (“ An error has occurred. Check your logs or contact the app author for clarification.”) when I go to the “Top Species” tab.

---

<div class="post-metadata">

**Author:** ![jlayman](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.inaturalist.org/jlayman/32/566_2.png) [@jlayman](https://forum.inaturalist.org/u/jlayman)\
**Post date:** [May 19, 2020, 2:51pm UTC](https://forum.inaturalist.org/t/inaturalist-user-trends-with-r/12538/4 "2020-05-19T14:51:33Z")

</div>

I just ran your username through the app, and while it took a minute to load, the data table in the top species tab loaded just fine. It may be that [shinyapps.io](http://shinyapps.io) had a momentary issue.

---

<div class="post-metadata">

**Author:** ![zorrosidekick](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.inaturalist.org/zorrosidekick/32/9203_2.png) [@zorrosidekick](https://forum.inaturalist.org/u/zorrosidekick)\
**Post date:** [May 19, 2020, 2:59pm UTC](https://forum.inaturalist.org/t/inaturalist-user-trends-with-r/12538/5 "2020-05-19T14:59:30Z")

</div>

I just got an error as well. Also, is there a way to know that it’s working or do you simply wait to see if the data appears?

---

<div class="post-metadata">

**Author:** ![josephthebirder](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.inaturalist.org/josephthebirder/32/4774_2.png) [@josephthebirder](https://forum.inaturalist.org/u/josephthebirder)\
**Post date:** [May 19, 2020, 3:01pm UTC](https://forum.inaturalist.org/t/inaturalist-user-trends-with-r/12538/6 "2020-05-19T15:01:50Z")

</div>

I also received the error message after trying multiple people’s usernames. The only time there isn’t an error is when I use @jlayman’s name.

---

<div class="post-metadata">

**Author:** ![jlayman](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.inaturalist.org/jlayman/32/566_2.png) [@jlayman](https://forum.inaturalist.org/u/jlayman)\
**Post date:** [May 19, 2020, 3:06pm UTC](https://forum.inaturalist.org/t/inaturalist-user-trends-with-r/12538/7 "2020-05-19T15:06:11Z")

</div>

If you run into error messages, try reopening the app; I believe that this is a shinyapps issue due to the amount of traffic. Shinyapps is by no means a perfect platform.  
@zorrosidekick got your errors after the first try, but the app worked for your username after I restarted it.

---

<div class="post-metadata">

**Author:** ![er1kksen](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.inaturalist.org/er1kksen/32/532_2.png) [@er1kksen](https://forum.inaturalist.org/u/er1kksen)\
**Post date:** [May 19, 2020, 3:18pm UTC](https://forum.inaturalist.org/t/inaturalist-user-trends-with-r/12538/8 "2020-05-19T15:18:48Z")

</div>

This is really cool! Thanks jlayman.

I thought the most interesting thing was the “month” graph. This month so far I’ve been feeling really bogged down, suddenly too busy to do as much observing as I’d like… and now I see that according to my stats I always have a May slump! March and April are really high, June-July-August-September really high, but May is just low. Must be May is always my spring “crunch time” for non-iNat things. There’s also a noticeable spike in December- must be when the cabin fever really hits.

---

<div class="post-metadata">

**Author:** ![chelonia\_cam](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.inaturalist.org/chelonia_cam/32/9299_2.png) [@chelonia\_cam](https://forum.inaturalist.org/u/chelonia_cam)\
**Post date:** [May 19, 2020, 3:27pm UTC](https://forum.inaturalist.org/t/inaturalist-user-trends-with-r/12538/9 "2020-05-19T15:27:22Z")

</div>

That is really cool

---

<div class="post-metadata">

**Author:** ![pisum](https://avatars.discourse-cdn.com/v4/letter/p/91b2a8/32.png) [@pisum](https://forum.inaturalist.org/u/pisum)\
**Post date:** [May 19, 2020, 4:28pm UTC](https://forum.inaturalist.org/t/inaturalist-user-trends-with-r/12538/10 "2020-05-19T16:28:05Z")

</div>

> [@jlayman](#):
>
> an interactive web app with R. I ended up creating an app that, given an iNaturalist username, downloads the users observation data set and generates a number of visualizations, tables, and maps regarding their usage of iNat.

there may be more efficient ways to collect user stats than to aggregate / visualize after downloading a user’s entire set of observations, especially if the user has a lot of observations. i think each of the things you’re showing can be accomplished via specific API endpoint ([http://api.inaturalist.org/v1/docs/](http://api.inaturalist.org/v1/docs/)):

- Major Taxa – do a Get Observations request for each iconic taxon, returning just one record for each request with only the id, and then use the total\_results value from each result set.
- Top Species – use the Get Observations Species Counts endpoint
- Quality Grade – do a Get Observations request for each quality grade, returning just one record for each request with only the id, and then use the total\_results value from each result set.
- Month – use the Get Observations Histogram endpoint
- Map – use the Observations Tiles set of your choice, plus the associated UTFGrid if you want to be able to show associated details when clicking on a marker.

what you created may be a good learning exercise, and it may work for many use cases, but you may want to consider making it more efficient if you find that other people start using it a lot.

---

<div class="post-metadata">

**Author:** ![abersbird](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.inaturalist.org/abersbird/32/5835_2.png) [@abersbird](https://forum.inaturalist.org/u/abersbird)\
**Post date:** [May 19, 2020, 5:48pm UTC](https://forum.inaturalist.org/t/inaturalist-user-trends-with-r/12538/11 "2020-05-19T17:48:43Z")

</div>

This is great! Thanks Jonathon. One thing though, is it possibly to make it so it shows your most ID’d organisms too?

---

<div class="post-metadata">

**Author:** ![austinsmith](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.inaturalist.org/austinsmith/32/998_2.png) [@austinsmith](https://forum.inaturalist.org/u/austinsmith)\
**Post date:** [May 19, 2020, 6:52pm UTC](https://forum.inaturalist.org/t/inaturalist-user-trends-with-r/12538/12 "2020-05-19T18:52:25Z")

</div>

Using this tool you can see how the stay at home order has changed my observation trends…

 ![Screen Shot 2020-05-19 at 2.50.01 PM](https://us1.discourse-cdn.com/flex016/uploads/inaturalist/original/2X/6/64d5acdd1920446f19aef46793dc6cd18ca6ab0c.png)

---

<div class="post-metadata">

**Author:** ![jlayman](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.inaturalist.org/jlayman/32/566_2.png) [@jlayman](https://forum.inaturalist.org/u/jlayman)\
**Post date:** [May 19, 2020, 7:14pm UTC](https://forum.inaturalist.org/t/inaturalist-user-trends-with-r/12538/13 "2020-05-19T19:14:21Z")

</div>

@pisum This was for a class on programming with R. The package for interfacing with iNaturalist and getting data, `rinat`, is still being developed, and currently can’t do any of those things outright- hence my brute force approach of downloading all observations and manipulating the data afterwards to achieve my objectives.

---

<div class="post-metadata">

**Author:** ![jlayman](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.inaturalist.org/jlayman/32/566_2.png) [@jlayman](https://forum.inaturalist.org/u/jlayman)\
**Post date:** [May 19, 2020, 7:16pm UTC](https://forum.inaturalist.org/t/inaturalist-user-trends-with-r/12538/14 "2020-05-19T19:16:34Z")

</div>

@abersbird bird The R package for handling iNaturalist data, `rinat`, currently doesn’t have the ability to access identification data, so I wouldn’t be able to do so without figuring out how to use the API.

---

<div class="post-metadata">

**Author:** ![pisum](https://avatars.discourse-cdn.com/v4/letter/p/91b2a8/32.png) [@pisum](https://forum.inaturalist.org/u/pisum)\
**Post date:** [May 19, 2020, 7:26pm UTC](https://forum.inaturalist.org/t/inaturalist-user-trends-with-r/12538/15 "2020-05-19T19:26:23Z")

</div>

> [@jlayman](#):
>
> I wouldn’t be able to do so without figuring out how to use the API

i’m not an R user myself, but i would guess it should be fairly straightforward to get data from the iNat API without rinat. if you figure out the basic process for that, i think that would open up a lot of possibilities for getting data from iNat, as well as other sources. this may help guide you down that path, if you’re interested: [https://datascienceplus.com/accessing-web-data-json-in-r-using-httr/](https://datascienceplus.com/accessing-web-data-json-in-r-using-httr/) or [https://blog.exploratory.io/working-with-json-data-in-very-simple-way-ad7ebcc0bb89](https://blog.exploratory.io/working-with-json-data-in-very-simple-way-ad7ebcc0bb89) or [http://zevross.com/blog/2015/02/12/using-r-to-download-and-parse-json-an-example-using-data-from-an-open-data-portal/](http://zevross.com/blog/2015/02/12/using-r-to-download-and-parse-json-an-example-using-data-from-an-open-data-portal/).

UPDATE: actually, i just remembered something. here’s some code that loarie posted in another thread that shows exactly how to pull data from the histogram API endpoint and generate a graph:  
[https://forum.inaturalist.org/t/1m-observations-this-month/2582/4](https://forum.inaturalist.org/t/1m-observations-this-month/2582/4).

---

<div class="post-metadata">

**Author:** ![twainwright](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.inaturalist.org/twainwright/32/304_2.png) [@twainwright](https://forum.inaturalist.org/u/twainwright)\
**Post date:** [May 20, 2020, 4:33am UTC](https://forum.inaturalist.org/t/inaturalist-user-trends-with-r/12538/16 "2020-05-20T04:33:43Z")

</div>

> [@jlayman](#):
>
> The package for interfacing with iNaturalist and getting data, `rinat` , is still being developed […]

Just to clarify – _rinat_ is apparently no longer being developed. CRAN dropped the _rinat_ package in January due to lack of response from the developers (see [here](https://cran.r-project.org/package=rinat)). Looking at the _rinat_ GitHub page ([github.com/ropensci/rinat](http://github.com/ropensci/rinat)), there’s been almost no work done on it since last summer.

---

<div class="post-metadata">

**Author:** ![chauncey](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.inaturalist.org/chauncey/32/1317_2.png) [@chauncey](https://forum.inaturalist.org/u/chauncey)\
**Post date:** [May 20, 2020, 3:31pm UTC](https://forum.inaturalist.org/t/inaturalist-user-trends-with-r/12538/17 "2020-05-20T15:31:27Z")

</div>

jlayman - This is very cool. Thank you!

---

<div class="post-metadata">

**Author:** ![pisum](https://avatars.discourse-cdn.com/v4/letter/p/91b2a8/32.png) [@pisum](https://forum.inaturalist.org/u/pisum)\
**Post date:** [May 20, 2020, 4:39pm UTC](https://forum.inaturalist.org/t/inaturalist-user-trends-with-r/12538/18 "2020-05-20T16:39:29Z")

</div>

not user stats related, but here’s another example of R code leveraging the iNaturalist API: [https://forum.inaturalist.org/t/what-things-are-misidentified-as-large-milkweed-bug/12571/4](https://forum.inaturalist.org/t/what-things-are-misidentified-as-large-milkweed-bug/12571/4).

---

<div class="post-metadata">

**Author:** ![Darxus](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.inaturalist.org/darxus/32/8757_2.png) [@Darxus](https://forum.inaturalist.org/u/Darxus)\
**Post date:** [May 21, 2020, 4:08pm UTC](https://forum.inaturalist.org/t/inaturalist-user-trends-with-r/12538/19 "2020-05-21T16:08:15Z")

</div>

Does this work with firefox? I load the page, leave the default username, click in that field, hit enter, and nothing happens.

---

<div class="post-metadata">

**Author:** ![Darxus](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.inaturalist.org/darxus/32/8757_2.png) [@Darxus](https://forum.inaturalist.org/u/Darxus)\
**Post date:** [May 21, 2020, 4:09pm UTC](https://forum.inaturalist.org/t/inaturalist-user-trends-with-r/12538/20 "2020-05-21T16:09:10Z")

</div>

Looks like it behaves the same way in chrome.

---

<div class="post-metadata">

**Author:** ![Darxus](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.inaturalist.org/darxus/32/8757_2.png) [@Darxus](https://forum.inaturalist.org/u/Darxus)\
**Post date:** [May 21, 2020, 5:13pm UTC](https://forum.inaturalist.org/t/inaturalist-user-trends-with-r/12538/21 "2020-05-21T17:13:09Z")

</div>

Okay, that’s what it does when it’s working. You enter a user name, hit enter, and it does nothing, giving no hint of whether or not it’s working, for a long time. And then you get graphs and stuff. Some kind of loading / processing indication would be nice.

[Next page](https://forum.inaturalist.org/t/inaturalist-user-trends-with-r/12538.md?page=2)
