TidyX 51: Building Statistical Models into Shiny Apps

We’ve done a fair bit of {shiny} over the past year, detailing different approaches to provide an interactive data environment for end users. However, one thing we haven’t done yet is talk about embedding statistical models into your {shiny} apps. This week, Ellis Hughes and I do just that.

We create a random forest classifier, which uses body size features to predict the probability that a penguin is one of three different species and embed this into a {shiny} web app. For this, we will be using the penguins data set form the {palmerpenguins} R package.

In addition to from making an interactive statistical app, we cover a few other nuances of {shiny} app development:

  • Organizing the user components horizontally across the top of the app versus the commonly used sidebar panel.
  • How to increase the size and width of the plot in the main panel.
  • How to center the plot within in the main panel.
  • How to add a title to the top of your {shiny} app.

To watch our screen cast, CLICK HERE.

To access our code, CLICK HERE.