-
Notifications
You must be signed in to change notification settings - Fork 113
/
00-app-presentation.Rmd
99 lines (64 loc) · 7.96 KB
/
00-app-presentation.Rmd
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Foreword {.unnumbered}
As a long-time R user (since Version `2.0.0` back in 2004), I have seen more than a few "game-changing" advancements which transformed my entire workflow and opened the doors to new possibilities I never imagined.
One of those came in late 2012 when RStudio released `{shiny}` to the R community.
I was absolutely floored by the very notion that I could create not just a web interface, but a dynamic web interface, all through R code!
To give a little perspective, the only web interfaces I had built before Shiny were very utilitarian PHP-powered sites with a MySQL database back-end to summarize local state parks data near my graduate school's location, and let's just say those projects would not win any awards for web design!
I certainly experienced the longtime adage of learning the hard way as I began to create Shiny apps at my day job and for personal projects.
Over the first year or so of my time with Shiny, I created small apps that revealed the potential it could bring, and it is still amazing that I somehow stitched those together without fully understanding the nuances of reactivity, optimal UI designs, and other software-development principles that a classically trained statistician and Linux enthusiast never knew about!
Things began to click in my mind bit by bit (especially after attending the first (and only) Shiny Developer Conference), and I found myself with the task of creating not just simple prototypes, but large-scale software products meant for **production** use.
Oh my, what have I gotten myself into?
While being a frequent visitor to the Shiny mailing list and the helpful `shiny` tag on Stack Overflow, I felt a serious lack of resources addressing the optimal techniques, best practices, and practical advice of taking my Shiny apps to production.
And then, one of the most transformative events in my R usage occurred.
During the 2019 `rstudio::conf`, I was checking out the excellent poster session and found the [Building Big Shiny Apps](https://thinkr-open.github.io/rstudioconf2019) poster presented by Colin Fay.
I had known Colin as a fellow curator for the [RWeekly](https://rweekly.org/) project and knew he had done some work with Shiny, but during his walkthrough I always had this loud voice in my head saying "Hey, Colin knows exactly what I've been thinking about!" This was the first time I saw the important challenges any Shiny app developer in this space will undoubtedly encounter stated in language I could relate to, even with me being new to the software development mindset.
Needless to say, I had tremendous fun talking Shiny and all things R with Colin and Vincent Guyader at the conferences, trying to soak up all of their insights and advice every chance I could.
Colin and I both agreed in our Shiny Developer Series [episode](https://shinydevseries.com/post/episode-2-golem) that creating resources for this audience was an important step in the evolution of sharing best practices with Shiny.
Fast forward to today, and you are now reading a tremendous resource aimed squarely at the R users in our world who have embarked on creating production-level applications.
*Engineering Production-Grade Shiny Apps* contains an excellent blend of both Shiny-specific topics (many of which have not been addressed in previous books about Shiny) and practical advice from software development that fit in nicely with Shiny apps.
You will find many nuggets of wisdom sprinkled throughout these chapters.
It's very hard to pick favorites, but certainly one that felt like a moment of enlightenment was the concept of building triggers and watchers to define your own patterns of object invalidation.
Now I use that technique in every app I create!
Of course, one of the key pillars holding the foundation of this book is the [`{golem}`](https://thinkr-open.github.io/golem) package, and I have found that the time I invested to learn the ins and outs of creating applications with `{golem}` has paid off significantly for creating my complex applications, especially with multi-person development teams.
As I was finishing my writing of this Foreword, my four-year-old son asked me, "Why does `{golem}` create nice things, Daddy?" Well, this book is easily the best way to explain that answer!
I hope reading *Engineering Production-Grade Shiny Apps* helps you on your journey to creating large Shiny applications!
> Eric Nantz - Host of the R-Podcast and the Shiny Developer Series
# Application presentation {.unnumbered}
This book uses a series of applications as examples.
## `{hexmake}` {.unnumbered}
`{hexmake}` is an application that has been designed to build hex logos.
It was built by Colin, and it serves two main purposes: it helps the creation of a logo, but mainly it serves as an example of some complex features you can use inside a `{shiny}` application (image manipulation, custom CSS, linking to an external database, save and restore, etc.).
Figure \@ref(fig:00-app-presentation-1) is a screenshot of this application.
(ref:hexmakefront) The `{hexmake}` application.
```{r 00-app-presentation-1, echo=FALSE, fig.cap="(ref:hexmakefront)", out.width="100%"}
knitr::include_graphics("img/hexmake.png")
```
The app is available at [engineering-shiny.org/hexmake/](https://engineering-shiny.org/hexmake/).
The code is available at [github.com/ColinFay/hexmake](https://github.com/ColinFay/hexmake).
## `{tidytuesday201942}` {.unnumbered}
`{tidytuesday201942}` is an application using the dataset from week 42 of `tidytuesday` 2019.
It was built by Colin, and it serves as an example of an app built from scratch using bootstrap 4.
Figure \@ref(fig:00-app-presentation-2) is a screenshot of this application.
(ref:tidytuesday) The `{tidytuesday201942}` application.
```{r 00-app-presentation-2, echo=FALSE, fig.cap="(ref:tidytuesday)", out.width="100%"}
knitr::include_graphics("img/tidytuesdayapp.png")
```
The app is available at [engineering-shiny.org/tidytuesday201942/](https://engineering-shiny.org/tidytuesday201942/).
The code is available at [github.com/ColinFay/tidytuesday201942](https://github.com/ColinFay/tidytuesday201942).
## `{minifying}` {.unnumbered}
`{minifying}` is an application to minify CSS, JavaScript, HTML, and JSON files.
It was built by Colin as a use case for the workflow of this book.
You will find the details of how this app was constructed in the Appendix, "*Use case: Building an App, from Start to Finish*".
Figure \@ref(fig:00-app-presentation-3) is a screenshot of this application.
(ref:minifying) The `{minifying}` application.
```{r 00-app-presentation-3, echo=FALSE, fig.cap="(ref:tidytuesday)", out.width="100%"}
knitr::include_graphics("img/minifying.png")
```
The app is available at [engineering-shiny.org/minifying/](https://engineering-shiny.org/minifying/).
The code is available at [github.com/ColinFay/minifying](https://github.com/ColinFay/minifying).
## Other applications {.unnumbered}
- `{shinipsumdemo}` is an application built by Cervan as an example for `{shinipsum}`, available at [engineering-shiny.org/shinipsumdemo/](https://engineering-shiny.org/shinipsumdemo/).
- `{golemhtmltemplate}` is an application built by Colin as an example for `{shinipsum}` and `shiny::htmlTemplate()`, available at [engineering-shiny.org/golemhtmltemplate/](https://engineering-shiny.org/golemhtmltemplate/).
- `{databasedemo}` is an application built by Cervan using an external database, available at [engineering-shiny.org/databasedemo/](https://engineering-shiny.org/databasedemo/).
- `{grayscale}` is an application built by Cervan using an external html template, available at [engineering-shiny.org/grayscale/](https://engineering-shiny.org/grayscale/).
- `{bs4dashdemo}` is an application built by Cervan with the `{bs4dash}` package, available at [engineering-shiny.org/bs4dashdemo/](https://engineering-shiny.org/bs4dashdemo/).
- `{shinyfuture}` is an application built by Cervan as an example of using `{promises}` and `{future}` inside a `{shiny}` app, available at [engineering-shiny.org/shinyfuture/](https://engineering-shiny.org/shinyfuture/).