#Observations KJ currently has 31 deals that have not been closed. Even though Matt has the most closed lost, he has the second most closed won deals. KJ has the most closed won deals. Jeff and Parker have the least closed loss deals. 0 of the 8 deals with an annual recurring revenue greater than or equal to 1 million dollars have not been won. Jeff’s ratio of deals won to deals lost is 6:1. Thomas currently has the biggest deal at 2.8 million dollars, but it is only in the proposal stage at the moment.

#install.packages("openintro")
#install.packages(tidyverse)
#install.packages("readxl")
library(ggplot2)
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
## ✔ tibble  3.1.8      ✔ dplyr   1.0.10
## ✔ tidyr   1.2.1      ✔ stringr 1.4.1 
## ✔ readr   2.1.3      ✔ forcats 0.5.2 
## ✔ purrr   0.3.4      
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
library(openintro)
## Loading required package: airports
## Loading required package: cherryblossom
## Loading required package: usdata
library(readxl)
Hubspot_Data_for_Class_1 <- read_excel("Hubspot_Data_for_Class_1.xlsx")
Hubspot_Data_for_Class_1
## # A tibble: 334 × 6
##    Record_ID   Deal_Name Deal_Stage       Close_Date          Deal_Owner Annua…¹
##    <chr>       <chr>     <chr>            <dttm>              <chr>        <dbl>
##  1 10279704247 MOS       Qualify          2023-04-21 16:12:00 Jay         150000
##  2 9794103143  MED       Proposal         2023-03-31 15:59:00 Jay        1000000
##  3 9434330372  CORE      Gain Sponsorship 2022-12-16 09:22:00 Jay         342500
##  4 9218714222  MON       Demo             2022-12-15 11:36:00 Jay         300000
##  5 8667386634  MMT       Closed lost      2022-06-03 08:22:00 Jay          22500
##  6 8665924620  NR        Closed won       2022-06-30 10:37:00 Jay          24200
##  7 8405622154  ATC       Deferred         2023-04-30 10:16:00 Jay         150000
##  8 8376067927  MAG       Closed lost      2022-04-21 09:43:00 Jay          30000
##  9 8052578899  CAR       Qualify          2023-03-31 11:33:00 Jay             NA
## 10 8051015557  IMP       Closed lost      2022-05-05 11:27:00 Jay         300000
## # … with 324 more rows, and abbreviated variable name ¹​Annual_Recurring_Rev
ggplot(Hubspot_Data_for_Class_1, aes(x = Deal_Owner)) +
  geom_bar()

ggplot(Hubspot_Data_for_Class_1, aes(x = Deal_Owner, y = Annual_Recurring_Rev, color = Deal_Stage)) +
  geom_point()
## Warning: Removed 58 rows containing missing values (geom_point).

##Closed lost and won
Enterprise_Closed <- filter(Hubspot_Data_for_Class_1, Deal_Stage == "Closed lost" | Deal_Stage == "Closed won")
print(Enterprise_Closed)
## # A tibble: 235 × 6
##    Record_ID  Deal_Name Deal_Stage  Close_Date          Deal_Owner Annual_Recu…¹
##    <chr>      <chr>     <chr>       <dttm>              <chr>              <dbl>
##  1 8667386634 MMT       Closed lost 2022-06-03 08:22:00 Jay                22500
##  2 8665924620 NR        Closed won  2022-06-30 10:37:00 Jay                24200
##  3 8376067927 MAG       Closed lost 2022-04-21 09:43:00 Jay                30000
##  4 8051015557 IMP       Closed lost 2022-05-05 11:27:00 Jay               300000
##  5 5281132294 MCC       Closed lost 2022-02-01 09:19:00 Jay               100000
##  6 80536468   ADC       Closed lost 2021-12-06 16:25:00 Jay                50000
##  7 6290897793 GUSI      Closed lost 2022-04-28 08:43:00 Jeff               30000
##  8 5293533834 USSS      Closed won  2021-05-31 18:54:00 Jeff                  NA
##  9 398502314  OHSU      Closed won  2020-12-09 16:23:00 Jeff              260300
## 10 301167866  USSS      Closed won  2021-04-15 13:13:00 Jeff              185000
## # … with 225 more rows, and abbreviated variable name ¹​Annual_Recurring_Rev
ggplot(Enterprise_Closed, aes(x = Deal_Owner, fill = Deal_Stage)) +
  geom_bar()

Enterprise_Matt <- filter(Hubspot_Data_for_Class_1, Deal_Owner == "Matt")
print(Enterprise_Matt)
## # A tibble: 76 × 6
##    Record_ID  Deal_Name Deal_Stage  Close_Date          Deal_Owner Annual_Recu…¹
##    <chr>      <chr>     <chr>       <dttm>              <chr>              <dbl>
##  1 6021505179 AMP       Closed lost 2022-04-12 14:15:00 Matt              112100
##  2 6021419871 INV       Closed won  2022-08-23 17:41:00 Matt              319000
##  3 5802428222 EH        Closed lost 2022-04-12 14:15:00 Matt              108000
##  4 5474458213 THC       Closed lost 2022-02-08 16:53:00 Matt              184600
##  5 5440361098 PU        Closed won  2022-07-14 12:17:00 Matt              118600
##  6 5073434773 UTG       Closed lost 2021-08-25 08:57:00 Matt               40000
##  7 5051861619 PCH       Closed lost 2022-02-07 11:37:00 Matt               41700
##  8 5051843664 CH        Closed lost 2021-08-25 08:57:00 Matt              108000
##  9 5051833358 MH        Closed lost 2021-08-25 09:03:00 Matt              220000
## 10 5051717456 AOH       Closed lost 2021-08-24 13:22:00 Matt              274000
## # … with 66 more rows, and abbreviated variable name ¹​Annual_Recurring_Rev
ggplot(Enterprise_Matt, aes(x = Deal_Owner, fill = Deal_Stage)) +
  geom_bar()

Enterprise_other <- filter(Hubspot_Data_for_Class_1, Deal_Stage == "Deferred" | Deal_Stage == "Contract" | Deal_Stage == "Demo" | Deal_Stage == "Gain Sponsorship" | Deal_Stage == "Proposal" | Deal_Stage == "Qualify", Deal_Owner == "KJ")
print(Enterprise_other)
## # A tibble: 31 × 6
##    Record_ID   Deal_Name Deal_Stage       Close_Date          Deal_Owner Annua…¹
##    <chr>       <chr>     <chr>            <dttm>              <chr>        <dbl>
##  1 10263616090 POL       Qualify          2023-06-30 09:23:00 KJ          100000
##  2 10184892819 AGC       Qualify          2022-12-31 12:10:00 KJ           25000
##  3 10117760550 MC        Qualify          2023-06-30 14:23:00 KJ          100000
##  4 9944126474  IN        Qualify          2023-03-31 11:56:00 KJ              NA
##  5 9872064110  MB        Qualify          2023-03-31 14:04:00 KJ              NA
##  6 9494292544  CEN       Demo             2023-03-31 10:24:00 KJ          110000
##  7 9413663363  ALM       Proposal         2023-03-31 16:09:00 KJ          110400
##  8 8938605686  ALJ       Gain Sponsorship 2022-09-30 13:30:00 KJ           14400
##  9 8738242958  COG       Gain Sponsorship 2022-12-31 15:00:00 KJ          100000
## 10 8579937362  SW        Demo             2023-12-31 12:34:00 KJ          100000
## # … with 21 more rows, and abbreviated variable name ¹​Annual_Recurring_Rev
Enterprise_KJwon <- filter(Hubspot_Data_for_Class_1, Deal_Stage == "Closed won", Deal_Owner == "KJ")
print(Enterprise_KJwon)
## # A tibble: 20 × 6
##    Record_ID  Deal_Name Deal_Stage Close_Date          Deal_Owner Annual_Recur…¹
##    <chr>      <chr>     <chr>      <dttm>              <chr>               <dbl>
##  1 7610485823 ALA       Closed won 2022-07-13 08:47:00 KJ                  21600
##  2 6911097101 ALC       Closed won 2022-04-20 16:05:00 KJ                 130500
##  3 5429811876 JPMG      Closed won 2021-06-22 14:48:00 KJ                 352000
##  4 5191267867 ALB       Closed won 2021-11-16 12:51:00 KJ                 138100
##  5 5141602361 COR1      Closed won 2021-11-16 17:06:00 KJ                 239000
##  6 2888538524 VERT      Closed won 2021-12-15 15:36:00 KJ                 100900
##  7 2836973689 HOUS      Closed won 2020-10-29 12:02:00 KJ                  48600
##  8 2657857468 HCAF      Closed won 2021-06-21 10:59:00 KJ                 245538
##  9 1427742616 BC        Closed won 2021-09-30 11:07:00 KJ                 292050
## 10 912128362  NNL       Closed won 2021-09-01 17:38:00 KJ                 151500
## 11 747816218  CARG      Closed won 2020-02-05 12:00:00 KJ                 390200
## 12 727600043  MPC       Closed won 2019-12-12 09:38:00 KJ                 235000
## 13 436810784  UPC       Closed won 2021-09-21 07:32:00 KJ                 275000
## 14 307640671  JPMC      Closed won 2019-06-26 09:28:00 KJ                 790000
## 15 255389036  HM        Closed won 2019-06-26 17:51:00 KJ                 161500
## 16 253655997  OHS       Closed won 2020-06-26 15:00:00 KJ                 542500
## 17 193577165  CA        Closed won 2018-10-16 10:47:00 KJ                 250000
## 18 150336627  WFBH      Closed won 2018-04-05 08:21:00 KJ                 198460
## 19 105694162  P66       Closed won 2018-11-07 12:20:00 KJ                 258180
## 20 70499375   CPC       Closed won 2019-01-04 12:11:00 KJ                 155711
## # … with abbreviated variable name ¹​Annual_Recurring_Rev
Enterprise_Won <- filter(Hubspot_Data_for_Class_1, Deal_Stage == "Closed won")
print(Enterprise_Won)
## # A tibble: 53 × 6
##    Record_ID  Deal_Name Deal_Stage Close_Date          Deal_Owner Annual_Recur…¹
##    <chr>      <chr>     <chr>      <dttm>              <chr>               <dbl>
##  1 8665924620 NR        Closed won 2022-06-30 10:37:00 Jay                 24200
##  2 5293533834 USSS      Closed won 2021-05-31 18:54:00 Jeff                   NA
##  3 398502314  OHSU      Closed won 2020-12-09 16:23:00 Jeff               260300
##  4 301167866  USSS      Closed won 2021-04-15 13:13:00 Jeff               185000
##  5 268205194  AMG       Closed won 2021-04-08 07:43:00 Jeff               190000
##  6 61675160   BU        Closed won 2021-03-30 16:19:00 Jeff                60000
##  7 61674890   HNDOE     Closed won 2018-04-02 00:00:00 Jeff               401920
##  8 7610485823 ALA       Closed won 2022-07-13 08:47:00 KJ                  21600
##  9 6911097101 ALC       Closed won 2022-04-20 16:05:00 KJ                 130500
## 10 5429811876 JPMG      Closed won 2021-06-22 14:48:00 KJ                 352000
## # … with 43 more rows, and abbreviated variable name ¹​Annual_Recurring_Rev
ggplot(Enterprise_Won, aes(x = Deal_Owner)) +
  geom_bar()