# Install the 'pak' package manager if you haven't already
install.packages("pak")
# Install 'r-shinylive' using 'pak'
::pak("posit-dev/r-shinylive") pak
Shiny 04: Deploying Shiny App
Deploying Shiny App using ShinyLive .
Welcome to our shiny
app development class! We are now fully prepared to deploy our shiny
app to our website.
There are several options available for deploying a shiny
app, and we will utilize our knowledge of using the quarto
website to accomplish this task.
1 Deploying Shiny App using Quarto with R Shinylive
We are going to use the following tutorial: Using r-shinylive for Serverless Shiny Apps in Quarto Documents
1.1 Step 1
To begin, you’ll need to install the r-shinylive
R package. This package is currently hosted on GitHub and can be easily obtained from the R console by executing the following command:
1.2 Step 2
To install the Quarto extension for shinylive
, follow these steps:
- Open the Terminal tab.
- Run the following command:
# quarto add quarto-ext/shinylive
1.3 Step 3
To include a Shiny app directly in your Quarto
file (.qmd), you need to add a filter key for shinylive
at the top of the desired Quarto
file. Open your Quarto
file and insert the following YAML header:
:
filters- shinylive
1.4 Step 4
You can include the code for a Shiny application in a code block indicated by {shinylive-r}. Here is an example of how your code block could appear:
---
: "Our first r-shinylive Quarto document!"
title:
filters- shinylive
---
```{shinylive-r}
#| standalone: true
#library(shiny)
# Define your Shiny UI here
#ui <- fluidPage(
# Your UI components go here
)
# Define your Shiny server logic here
#server <- function(input, output, session) {
# Your server code goes here
}
# Create and launch the Shiny app
#shinyApp(ui, server)
1.5 Step 5
If you have encountered issues with the quarto publish
function, you can easily resolve them by adding the following steps:
:
format:
html:
resources- shinylive-sw.js