A Shiny app for estimating the distribution of the three-toed sloth 🦥🌳🔍
The Slothful Seer Shiny application is a tool developed to assist in understanding the distribution patterns of the three-toed sloth. It provides an interface for exploring observation data of the species in question, as well as other relevant data such as environmental factors and eco-regions. Utilizing machine learning and statistical models, this application utilizes the various data sources to predict the distribution of the species across the study area.
The app can be run from an R console (e.g., RStudio) either by cloning this repository, or running the app locally by directly connecting to Github through the shiny::runGitHub()
function as demonstrated below.
# This code that can be pasted into an R console to run locally without cloning the repo:
shiny::runGitHub(repo="benton-tripp/slothful-seer/")
Here is a list of packages needed to run the app, as well as code that can be run to ensure each of the required packages is installed:
shiny
shinyjs
shinydashboard
shinybusy
DT
tidyverse
dismo
maptools
ggpubr
rJava
skimr
leaflet
leaflet.extras
raster
spatstat
caret
gbm
plyr
caTools
rpart
e1071
ranger
glmnet
Matrix
sp
sf
rgdal
htmlwidgets
rgeos
shinyWidgets
# Install required libraries
install.packages(c(
"shiny", "shinyjs", "shinydashboard", "shinybusy", "DT", "tidyverse",
"dismo", "maptools", "ggpubr", "rJava", "skimr", "leaflet", "leaflet.extras",
"raster", "spatstat", "caret", "gbm", "plyr", "caTools", "rpart", "e1071",
"ranger", "glmnet", "Matrix", "sp", "sf", "rgdal", "htmlwidgets", "rgeos",
"shinyWidgets"
))
Note that rJava
also requires a 64-bit version of Java installed, along with the JAVA_HOME
environment variable set. To install Java, see the Oracle website. After installation, either set the JAVA_HOME
environment variable (e.g., using a Windows desktop run setx PATH "C:\C:\Program Files\Java\jdk-VERSION;%PATH%"
from the command line, replacing "VERSION" with the correct version), or set it from your R environment using the Sys.setenv()
function prior to loading the library in an R session.
Docker can be used as an alternative to running the application from R locally. This is a good alternative if package versions and/or Java are giving you grief. The GIS packages (rgdal
, sp
, sf
, raster
, dismo
, etc.) can be especially troublesome to install without any errors, depending on the OS and R version.
There are a couple of options of how you might run the app using Docker:
- Pull the image from Docker Hub (easier/faster method)
- Build the image from the Dockerfile included in this repository
- Run
docker pull bentontripp/slothful-seer-app:latest
- Then run
docker run --rm -p 4000:3838 bentontripp/slothful-seer-app:latest
to start a container - Open up a browser, navigate to http:/127.0.0.1:4000
- To stop, run
docker stop [CONTAINER_ID]
- Download the Dockerfile (or clone the full app), and navigate to the directory with the file
- Run
docker build -t slothful-seer-app .
to create an image (this can take 5-10 minutes to complete) - Then run
docker run --rm -p 4000:3838 slothful-seer-app
to start a container - Open up a browser, navigate to http:/127.0.0.1:4000
- To stop, run
docker stop [CONTAINER_ID]