Shiny App-Packages
Getting your app into an R package
Welcome!
Shiny combines the power of Râs statistical capabilities with the interactivity of a web-based application.
R packages are collections of pre-built, self-contained code, data, and documentation designed to perform operations or accomplish tasks beyond the capabilities of the R language.
Whatâs in the book
This book is a resource to help âconnect the dotsâ between building scalable Shiny applications and writing R packages. Adopting R package development practices in the early stages of your Shiny app will improve the reusability, maintainability, and shareability of all your hard work.
The code and data originate from the excellent Building Web Applications with Shiny (BWAS) course. If youâre new to Shiny development this course is a great place to start. The four learning modules will provide a solid understanding for many of the topics covered in this book.
Recent Updates!
This resource is being revised to include recent changes in the Shiny development landscape (Positron, LLM tools and packages, etc.). While most of the information in the Introduction and App-packages sections will remain unchanged, I will continue to update the other sections as Shiny app (and R package) development evolves and changes. Expand the callout boxes below to view the new sections and updates.
Whatâs not in the book
This book isnât a replacement for Mastering Shiny or R Packages, 2ed (or Writing R Extensions). I highly suggest bookmarking these resources to return and read when youâd like to learn more about R package and Shiny development.
I also wonât be recommending a particular Shiny framework or package, but Iâll cover a few popular choices, show what theyâre doing âunder the hood,â and let you decide if youâd like to adopt their practices.
What I assume about you
If youâre reading this, I assume youâre comfortable with R, RStudio, Shiny, and the tidyverse
. Maybe you havenât built a ton of applications, but you understand reactivity, and youâre comfortable with the core Shiny concepts (i.e., the UI, server, *_Input()
, *_Output()
, and render_
* functions, etc.).
Code examples
The code files for each chapter are stored in GitHub repository. Major code changes are stored in branches. Whenever a new branch is used, youâll see the Git Branch icon with a link to the repo/branch in the margin.
In an effort to make the code and examples more accessible and easy to use, Iâve also created the shinypak
package. This package can be used to launch or download the applications in each branch.1
Example:
# install.packages('pak') ::pak('mjfrigaard/shinypak') pak::launch('02.3_proj-app') shinypak
shinypak
uses the.Rproj
files to launch apps, so a an installation of RStudio is required. However, the applications in each branch still be downloaded withshinypak::get()
.âŠď¸