Mohamed Lemine Beydia
12/12/2021
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:
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)]
| 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 |
| 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 |