Shiny App-Packages
Getting your app into an R package
Welcome!
Develop your Shiny application as an R package.
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.
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 thse resources to return and read when you’d like to learn more about package 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, Posit Workbench, 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:
Example:
# install.packages('pak') ::pak('mjfrigaard/shinypak') pak::launch('09.2_inst-bslib') shinypak