A basic Shiny Dashboard

Mohamed Lemine Beydia
12/12/2021

Overview

This is the reproducible pitch presentation for the final course project of Coursera Data Science Specialization Course 9: Developing Data Science Tools. This document will go over the basics of developing a basic Shiny Dashboard app. For more information, please see the following links:

  1. The customers dataset can be accessed with the command data(customers) in R. Note that this dataset was modified (randomly) to include some useful features.
  2. The GitHub repository containing the R codes required to build the Shiny App (server.R and ui.R)can be accessed here
  3. The Shiny app can be accessed here, which contains
    • A dashboard page summarizing some information on customers, sales and products.
    • Other pages with Histogram,boxplot and a downloadable raw dataset.

Data set exploration (1/2)

library(datasetsICR)
library(randomNames)
library(kableExtra)
library(dplyr)
# load the dataset
data(customers)
# add customers'ID
customers$CustomerID<-1:nrow(customers)
# add some random names, gender and ethnicity for each customer
customers<-cbind(customers,randomNames(nrow(customers), 
                                       return.complete.data=TRUE))
# variables' recoding
customers$gender<-ifelse(customers$gender==1,"Female","Man")
customers$Channel<-ifelse(customers$Channel==1,"Hotel/Restaurant/Cafe"
                          ,"Retail")

customers$Region<-ifelse(customers$Region==1,"Lisbon",
                         ifelse(customers$Region==2,"Oporto","Other"))
# add age and total_spent variables for each customer
customers$Age<-round(rnorm(nrow(customers), mean = 50, sd = 10),digits=0)
customers$Total_spend<- as.numeric(apply(customers[,3:8], 1, sum))
# reorder the dataset
customers<-customers[c(9,12,13,14,10,11,1:8,15)]

Data set exploration (2/2)

Subset with the first 7 variables
CustomerID first_name last_name Age gender ethnicity Channel
1 Andrew Mattice 34 Man 1 Retail
2 Destiny Simpkins 57 Female 3 Retail
3 Timmya Rogers 54 Female 3 Retail
4 Dewi Krumland 47 Female 2 Hotel/Restaurant/Cafe
Subset with the last 8 variables
Channel Region Fresh Milk Grocery Frozen Detergents_Paper Delicassen Total_spend
Retail Other 12669 9656 7561 214 2674 1338 34112
Retail Other 7057 9810 9568 1762 3293 1776 33266
Retail Other 6353 8808 7684 2405 3516 7844 36610
Hotel/Restaurant/Cafe Other 13265 1196 4221 6404 507 1788 27381

Some Basic charts

A captionA caption

Screenshots

A caption A caption A caption