What things are misidentified as large milkweed bug?

i’ve never used R before, but here’s what i did to run alexis18’s script and generate the figure:

  1. download and install R from https://cran.r-project.org/. (i use 64-bit Windows. so i downloaded the Windows installer from https://cran.r-project.org/bin/windows/base/ and installed just the core files and 64-bit files.)
  2. download and install RStudio Desktop from https://rstudio.com/products/rstudio/download/.
  3. open RStudio, and go to File > New File > R Script… copy alexis18’s code above and paste it into the new R script window.
  4. change the taxon_id and taxon_name in lines 7 and 8, if you want to run the script for something other than Apis mellifera.
  5. note that the first 3 lines of the code are commented out. (they begin with a #.) these commands only need to be run once, since they’re basically installing some packages that the rest of the script uses. (if you have the packages installed already, you don’t need to run these lines.)
  6. run the first line by highlighting everything on that line except the #, and then click the run button. this will install a bunch of packages and dependencies. it may take a while to download and install everything. so just wait until the stop button in the console window below the script window goes away. there may be some prompts that pop up along the way that you may have to respond to in the console window, too. (as an alternative to running that first line, you can also go to Tools > Install Packages… and install the packages from there.)
  7. once those 3 packages and dependencies are fully installed, highlight everything in the second line except the #, and run that.
  8. then highlight everything in the third line of the script except the #, and run that.
  9. from there, just continue to click the run button to run through the rest of the script.
  10. when you’ve run the last line, the resulting visualization should pop up in a Viewer window in the bottom-right corner of RStudio. you can zoom in on the result to view it in more detail, or you can export it as an image for use outside of RStudio.

the specific part of alexis18’s code that actually gets the data from iNaturalist (via its API) is in the section labeled “API Call”. generally, there appear to be many ways in R to get data from an API. you could do an internet search to learn more, or i’ve also noted some resources (from my own quick internet search) here: https://forum.inaturalist.org/t/inaturalist-user-trends-with-r/12538/15.

11 Likes