Code

Expand the boxes below to review what was covered in previous three chapters:

The Docker chapter covered the following topics:

The applications in Chapter 15 (Docker) can be accessed with the launch() or get() functions from the shinypak R package:

# install.packages('pak')
pak::pak('mjfrigaard/shinypak')
library(shinypak)

Chapter 15 applications:

list_apps(regex = '^15')
## # A tibble: 1 × 2
##   branch    last_updated       
##   <chr>     <dttm>             
## 1 15_docker 2024-08-01 11:41:37

Continuous integration and continuous deployment is demonstrated using GitHub Actions to automate three workflows:

The applications in Chapter 16 (CI/CD) can be accessed with the launch() or get() functions from the shinypak R package:

# install.packages('pak')
pak::pak('mjfrigaard/shinypak')
library(shinypak)

Chapter 16 applications:

list_apps(regex = '^16')
## # A tibble: 3 × 2
##   branch          last_updated       
##   <chr>           <dttm>             
## 1 16.1_gha-style  2024-08-01 11:56:09
## 2 16.2_gha-shiny  2024-08-01 12:21:04
## 3 16.3_gha-docker 2024-08-01 12:49:40

The pkgdown chapter covers build a package website and deploying it with GitHub Actions.

The applications in Chapter 17 (pkgdown) can be accessed with the launch() or get() functions from the shinypak R package:

# install.packages('pak')
pak::pak('mjfrigaard/shinypak')
library(shinypak)

Chapter 17 applications:

list_apps(regex = '^17')
## # A tibble: 1 × 2
##   branch     last_updated       
##   <chr>      <dttm>             
## 1 17_pkgdown 2024-08-02 09:40:00

Shiny simplifies the creation of interactive web applications by allowing you to write R code that is automatically translated into HTML, CSS and JavaScript. However, sometimes it’s necessary to include non-R code files as supplemental resources to improve your application. This section will cover how to include HTML, CSS, and JavaScript files in a Shiny app-package.

Application upgrades

This section also introduces a few upgrades to the Shiny application in shinyrPkgs:

  1. The layout has been upraded to the page_navbar() from bslib
    1. The UI outputs now sit in nav_panel()s, with collapsible sidebars and footers.1
    2. The scatter-plot tab includes a table display of the movies data using the reactable package.
  2. Improved plots
    1. We’re using rlang’s injection operator (!!) for the plot inputs (instead of the .data masking), so the plotting modules now contain the ggplot2 functions used to create the graphs.
    2. A new plot label formatting function (label_titler()) makes it easier to convert variable inputs into title case.
  3. New graphs for viewing metrics by year and distributions

HTML

In HTML chapter, we’ll explore how to embed HTML within Shiny apps, use tags and functions to enhance UI layouts, and leverage HTML templates for more complex designs.

Additionally, we’ll cover how to seamlessly combine Shiny’s reactive outputs with custom HTML elements to build interactive interfaces.

CSS

The CSS chapter delves into the art of styling your Shiny applications, ensuring they are both visually appealing and user-friendly. We discuss how to apply custom styles to your app using CSS, enabling you to customize the appearance of your elements beyond Shiny’s default themes. You’ll learn how to include external CSS files, write inline styles, and utilize CSS frameworks like Bootstrap for responsive design. Through practical examples, we demonstrate how to manage CSS specificity, create reusable styles, and enhance the overall user experience by controlling layout, typography, colors, and animations.

JavaScript

In the JavaScript chapter, we cover how to extend the functionality of your Shiny applications with custom JavaScript. JavaScript can be used to handle client-side interactivity, manipulate the DOM, and integrate third-party libraries and APIs. We’ll show you how to include JavaScript files in your Shiny app-package, write custom JavaScript code that interacts with Shiny’s reactive model, and use Shiny’s JavaScript functions to create more dynamic and responsive applications. This chapter equips you with the skills to bridge the gap between Shiny’s R-based framework and the extensive capabilities of JavaScript, enhancing your app’s performance and user interaction.

Style

Style covers formatting the code in your package so it’s easier to debug (and read).


  1. bslib uses cards to display contents inside each nav_panel(). The outputs use card() with layout_sidebar(), card_body(), and card_footer(). Learn more on the bslib website.↩︎