Developing Data Products – Course Project: Sales Analytics Dashboard



Developing Data Products – Course Project: Sales Analytics Dashboard

0 0


slidify_pres

Developing Data Products: Slidify Presentation

On Github mdancho84 / slidify_pres

Developing Data Products

Course Project: Sales Analytics Dashboard

Coursera Data Science Specialization

Matt Dancho / GitHub / LinkedIn

"Turn sales information into insight through the magic of Shiny"

The Assignment

The goal of this assignment is to build:

A Shiny application that has widget input, ui input in server.R, reactive output using server calculations, and supporting documentation.

A Reproducible Pitch Presentation that contains five slides in either Slidify or Rstudio Presenter that is pushed to and hosted on GitHub or Rpubs and contains embedded R code that runs.

Links to Project App & Docs

Shiny App: Link

server.R and ui.R files: Link

The Data

The data was simulated using a set of scripts I created as part of a side project called orderSimulatoR. The data simulation is intended to mimic real-world sales data for an organization. The data contains information related to customer orders such as order.id, products purchased, customer information (name and location), unit price, quantity sold, and so on. The simulated data was then used for analysis purposes as part of the Sales Analytics Dashboard.

If your interested, the product names and prices came from the bicycle manufacturer, Cannondale, but the customer names and order details are all made up from the orderSimulatoR scripts. For more information on the data set, you can view my orderSimulatoR blog post.

The Sales Analytics Dashboard

Make Selections to Unlock Insights

There's a lot you can do with the Sales Analytics Dashboard. Here's a few suggestion to get started:

  • Imagine you are an executive at Cannondale in charge of strategy and business development. Your goal is to understand which products Cannondale's customers are purchasing, which customers are purchasing the most, and what the organization can do to improve sales.

  • Use the Reactive Inputs to filter by year, product unit price, product primary category, and product secondary category.

  • On the Analysis tab, see how the filters can be used to drill into the information. See if there are any insights that you can come up with from the data.

  • Switch to the Data tab to see how the filters control the data. Subset the data, and try downloading the csv file.

  • Use the Reset Fields button when finished. See how the data set refreshs to its original size and how all of the reactive inputs reset.

Code Example

Leaflet: Visualize Customers By Location

library(leaflet)
library(htmlwidgets)
library(knitr)
library(dplyr)

# Load data
setwd("../shiny-app")
source("./scripts/helper.R")
orders.extended <- read.data()
setwd("../slidify-pres")

# Get sales by location
salesByLocation <- orders.extended %>%
        group_by(bikeshop.name, longitude, latitude) %>%
        summarise(total.sales = sum(price.extended)) %>%
        mutate(popup = paste0(bikeshop.name, 
                              ": ", 
                              scales::dollar(total.sales)))

# Use Leaflet package to create map visualizing sales by customer location
l <- leaflet(salesByLocation) %>% 
  addProviderTiles("CartoDB.Positron") %>%
  addMarkers(lng = ~longitude, 
             lat = ~latitude,
             popup = ~popup) %>%
  addCircles(lng = ~longitude, 
             lat = ~latitude, 
             weight = 2,
             radius = ~(total.sales)^0.775)

# Move to img folder
setwd("./assets/img")
saveWidget(l, 'leaflet1.html') # Save widget html
setwd("../..")

# Source saved file
cat('<pre><iframe src="./assets/img/leaflet1.html" width=100% height=350px allowtransparency="true"> </iframe></pre>')