R Shiny {golem} – Designing the UI – Part 1 – Development to Production

[This article was first published on Stoltzman Consulting Data Analytics Blog - Stoltzman Consulting, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Welcome to the first in a series of blog posts surrounding R’s {golem} package by Colin Fay. In case you missed it, we laid out what these posts will cover in last week’s post.

One main step of our development process is to think about how we want the app to look structurally and aesthetically. This is an important step since it directly influences the user’s experience. Before sketching out the app, we must have a better understanding of the data that is available to us. In our scenario with The Office, we have data regarding: advertising, revenue, ratings, and the script.

Let’s take a look at these datasets:



Each row in the script dataset contains information surrounding the season, episode, script text, the character speaking, and whether the line was deleted or not. This dataset is great for a text analysis. We can likely disregard the “deleted” column and work on breaking down our script analysis by seasons and episodes.



The rows in this dataset provide us with a season number, title, air date, rating, number of votes, description, director(s), and writer(s) for each episode. However, we notice that the episode’s number is not included. We will add an episode number identifier later on. Similar to the script data, we can gain insight for ratings across episodes, writers, and directors.

Revenue and Advertising


For the purpose of this example, we simulated data to represent revenue and advertising. The simulated revenue and advertising values start on the first episode air date, 3/24/05, and end on the last episode air date. The advertising sectors included are: Google, Facebook, Instagram, and display.

Based on specifications decided by the client, we agreed to the following layout for the Shiny dashboard:


From this glimpse of the app’s structure, we see that the sales analysis contains an overview page and a breakdown by seasons. We’re able to analyze ratings further by looking into episodes, characters, writers, and directors. The dashboard also includes a script analysis. Additionally, we can begin to think about possible plots and charts to incorporate.. Perhaps a plot of ratings across episodes for each season, a table of average seasonal ratings, or a pie chart of advertising expenditures.

In thinking ahead, we’ll stay organized by creating modules for each of these tabs to help keep it organized.

In our next post we will initialize our project in R and discuss the files/tools that come with golem. Until next time..

“This is a dream that I’ve had…since lunch…and I’m not giving it up now.” – Michael Scott

SCRIPT_DATA <- readr::read_csv('The Office - Script Data.csv')
IMDB_DATA <- readr::read_csv('The Office - IMDB Data.csv')
REVENUE_ADV <-  readr::read_csv('revenue_and_adv.csv')

Data sources used:



To leave a comment for the author, please follow the link and comment on their blog: Stoltzman Consulting Data Analytics Blog - Stoltzman Consulting.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)