Shiny App Installation via Anaconda Cheat Sheet
Step 1: Install Anaconda
Ensure Anaconda is installed on your system. Download it from the official website.
Step 2: Update Conda
Update Conda to the latest version using the command:
conda update conda
Step 3: Create a New Environment
Create a new Conda environment for the Shiny app:
conda create --name shiny_app_env r-essentials r-base
Step 4: Activate Environment
Activate the newly created environment:
conda activate shiny_app_env
Step 1: Install Shiny Package
Within the R console, install the Shiny package:
install.packages("shiny")
Step 2: Verify Shiny Installation
Load the Shiny library to verify it's installed correctly:
library(shiny)
Step 3: Shiny Server (Optional)
If you need the Shiny server, install it separately:
conda install -c r r-shiny-server
Step 4: Additional Dependencies
Install any other dependencies your Shiny app may require using:
install.packages("package_name")
Step 1: Run App Locally
Run your app from within the R environment using:
runApp('path_to_app')
Step 2: Launch App in Browser
Shiny will display a message with the address (usually http://127.0.0.1:port) to open in a web browser.
Step 3: Custom Port
To run the app on a different port:
runApp('path_to_app', port=desired_port_number)
Step 4: Stop App
To stop the app, press Ctrl + C in the R console.
List Environments
List all available Conda environments:
conda env list
Remove Environment
Remove an environment if no longer needed:
conda env remove --name shiny_app_env
Export Environment
Export your env's package list for reproduction:
conda list --export > package-list.txt
Import Environment
Create an env from a package list:
conda create --name new_env --file package-list.txt
Launch Navigator
Open Anaconda Navigator from the terminal:
anaconda-navigator
Manage Environments
Use the Navigator's GUI to create, activate, or delete environments.
Launch R Studio
If R Studio is installed, you can launch it from the Navigator.
Access Shiny Apps
Navigate to the Shiny app directory and run apps using R Studio's interface.
Common Installation Issues
Check the R/Shiny package versions for compatibility issues and update if necessary.
Environment Activation
Ensure the correct environment is activated before launching the Shiny app.
Firewall Settings
Ensure your firewall allows traffic on the Shiny app's port if running on a server.
Shiny Server Logs
If using Shiny Server, consult the logs for debugging information:
/var/log/shiny-server/