Getting Started: RStudio and Shiny
hi Jake!
1. Install R and RStudio
To run a Shiny app, you need both the R programming language and the RStudio interface installed on your computer.
- Install R: First, navigate to the CRAN website. Select your operating system (Windows, macOS, or Linux) and download the latest release of R. Run the downloaded installer using the default settings.
- Install RStudio: Next, go to the Posit RStudio download page. Download the free RStudio Desktop version for your operating system and run the installer.
2. Download the data files
The shiny interactives require a folder that contains the app.r file, which generates the interactive, and a data folder, which contains the underlying data.
The following folder has three shiny app folders, each with an app.r file and a data foler. Download these to your drive.
https://drive.google.com/drive/folders/1-wzepmUGuibcFPA_AiqKEKpH03mYDcbS?usp=drive_link
oedipodonae_module_1 walks students through basic data exploration of the number of occurrences and their climatic and geographic dimensions for the genera/ species of the Oedipodonae in western NA.
oedipodonae_module_2 walks students through developing CART models.
oedipodonae_module_3 walks students through developing Random Forest models.
3. Open and Run a Shiny App Locally
Once both programs are installed, follow these steps to launch your interactive application:
- Launch RStudio: Open the RStudio application on your computer.
- Open the File: Go to the top menu and select File > Open File…. Navigate to the folder on your local drive where your
app.Rfile is saved, select it, and click Open. - Run the App: With the
app.Rscript open in the top-left editor pane, look for the green Run App play button at the top right corner of the script window. Click it to launch the app.
Note: If a yellow banner appears at the top of your script asking you to install the
shinypackage (or if it throws a “package not found” error), you can install it by typinginstall.packages("shiny")into the Console tab at the bottom left and pressing Enter.