-
Notifications
You must be signed in to change notification settings - Fork 0
/
preface.qmd
81 lines (46 loc) · 6.83 KB
/
preface.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Preface {#sec-preface .unnumbered}
```{r}
#| eval: true
#| echo: false
#| include: false
source("_common.R")
"#3a506b"
```
Shiny App-Packages attempts to combine and distill Shiny *and* R package development practices from multiple resources.
## Why this book?
:::: {layout="[75, 25]" layout-valign="center"}
[Did you read [R Packages, 2ed](https://r-pkgs.org/) and find it difficult to apply package development practices to your Shiny application?]{style='font-size: 1.05em; font-weight: bold; font-style: italic; color: #3a506b;'}
![](images/rpkgs_cover.png){class="cover" width="300" fig-align="right"}
::::
[R Packages, 2ed](https://r-pkgs.org/) is _the_ premier resource for learning the best practices when creating functions, writing documentation, managing package namespaces, and many other fundamental aspects of package development. However, [R Packages, 2ed](https://r-pkgs.org/) primarily focuses on creating conventional R packages, so doesn't cover Shiny programming (designing user interfaces, server-side computations, modules, etc.). Moreover, testing and debugging a Shiny application differs from the traditional methods used in R packages.
:::: {layout="[25, 75]" layout-valign="center"}
![](images/mastering_shiny_cover.png){class="cover" width="300" fig-align="left"}
[Did you read [Mastering Shiny](https://mastering-Shiny.org/) and want to learn more about package development?]{style='font-size: 1.10em; font-weight: bold; font-style: italic; color: #3a506b;'}
::::
[Mastering Shiny](https://mastering-shiny.org/) is an excellent introduction to the world of [Shiny](https://shiny.posit.co/) and provides a foundation of best practices for developing applications. R packages *are* introduced near the [end of Mastering Shiny](https://mastering-shiny.org/scaling-packaging.html), and this chapter is a great place to start.[^r-pkgs-testing-diffs] However, to fully understand and appreciate the benefits of developing your Shiny app as an R package, it's helpful to have an example app-package that includes the full suite of the package development tools (loading, documenting, testing, installing, etc.).[^mastering-shiny-app-packages-1]
[^r-pkgs-testing-diffs]: [Testing Shiny apps](https://shiny.posit.co/r/articles/improve/testing-overview/) requires additional packages and tools to ensure an application's reliability and performance.
[^mastering-shiny-app-packages-1]: The ['Converting an existing app' chapter](https://mastering-shiny.org/scaling-packaging.html#converting-an-existing-app) provides an example of converting a Shiny app into an R Package. However, many of the helpful package development tools [aren't available](https://github.com/hadley/monthApp) (i.e., `roxygen2` tags, `NAMESPACE` imports/exports, tests, vignettes, etc.).
### Other Shiny Resources
Throughout the course of writing this book, the Shiny community has grown and other resources have been published for developing and customizing Shiny applications. Two popular resources are [Engineering Production-Grade Shiny Apps](https://engineering-shiny.org/) and [Outstanding User Interfaces with Shiny](https://unleash-shiny.rinterface.com/).
:::: {layout="[75, 25]" layout-valign="top"}
[Engineering Production-Grade Shiny Apps](https://engineering-shiny.org/) introduces the [`golem`](https://thinkr-open.github.io/golem/) package, which is an ‘*opinionated framework for building production-grade Shiny applications*’. `golem` offers a robust and standardized way to build, maintain, and deploy production-grade Shiny apps. Whether due to the learning curve, number of features, dependencies, or a particular set of deployment constraints, `golem` might not be the right fit for your application.[^golem-app-packages-2]
![](images/epgsa_cover.png){width="150" fig-align="left"}
::::
:::: {layout="[25, 75]" layout-valign="top"}
![](images/ouiws_cover.png){width="220" fig-align="right"}
[Outstanding User Interfaces with Shiny](https://unleash-shiny.rinterface.com/) '*addresses a specific gap between the beginner and advanced level*' focusing on customizing your Shiny application with HTML, CSS and JavaScript. It introduces [`charpente`](https://rinterface.github.io/charpente/), which streamlines the creation of Shiny development by quickly creating an R package, importing external web dependencies for JavaScript and CSS, initializing input/output bindings, and providing custom handler boilerplates. `charpente` also offers a high-level interface to `htmltools` (the workhorse that converts R code to web-friendly HTML).
::::
We'll cover both of these texts more in the [frameworks section](frameworks.qmd).
[^golem-app-packages-2]: `golem` apps *are* built as packages. Still, [EPGSA](https://engineering-shiny.org/) assumes the reader is '[comfortable with building an R package.](https://engineering-shiny.org/structuring-project.html#resources)' (*if you're familiar with package development, [EPGSA](https://engineering-shiny.org/) is an excellent resource*).
## Acknowledgments
This book is the result of multiple discussions with 1) Shiny developers who were new to writing R packages, 2) R package authors who were learning Shiny development and testing, and 3) new R users who wanted to build a robust and scalable application. Shiny App-Packages wouldn't have been possible without the contributors below (and I am deeply grateful for all of their help!).
- [Henry Bernreuter](https://github.com/HenryBernreuter) & [Elizabeth Marshallsay](https://www.youtube.com/@lilybuguk) for the initial discussions that created the outline for this book
- [Andrew Bates](https://github.com/asbates) for being an exemplary developer and professional, quietly building outstanding UIs, applications, and packages
- [Eric Simms](https://github.com/esimms999) for asking so many great questions, reviewing chapters, and giving phenomenal feedback
- [Eric Nantz](https://github.com/rpodcast)[^nantz-linkedin] for his [R podcast](https://r-podcast.org/), [Shiny developer series](https://shinydevseries.com/), [workshops](https://posit-conf-2023.github.io/shiny-r-prod/), and everything else he does for the Shiny community
- [Philip Bowsher](https://github.com/philbowsher) for everything he does for the R/Pharma conference and community
- [Ted Laderas](https://github.com/laderast) for his excellent [gRadual intRoduction to Shiny](https://laderast.github.io/gradual_shiny/) course and insightful blog posts
- [Jennifer Bryan](https://github.com/jennybc) and [Hadley Wickham](https://github.com/hadley) for their posit::conf(23) [package development masterclass workshop.](https://github.com/posit-conf-2023/pkg-dev-masterclass)
- [Maya Gans](https://github.com/MayaGans) for having multiple conversations and Shiny modules and package dependencies
- [Leon Samson](https://github.com/LDSamson) for his feedback on the testing chapters
[^nantz-linkedin]: Eric's [LinkedIn](https://www.linkedin.com/in/eric-nantz-6621617)