---
title: "Kahoot Report"
author: "Scary Scarecrow"
date: "5/4/2022"
output:
  html_document:
    theme: lumen
    highlight: tango
    self_contained: true
    toc: true
    toc_depth: 4
    toc_float: true
    css: style.css
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(
	echo = FALSE,
	message = FALSE,
	warning = FALSE
)
culture<-data.frame(Answer=c("Definitely","Somewhat","No Way","Not Sure","No Answer"),
                    Votes=c(0,7,0,0,1))
training<-data.frame(Answer=c("Definitely","Somewhat","No Way","Not Sure","No Answer"),
                    Votes=c(0,3,3,2,0))
mentor<-data.frame(Answer=c("Definitely","Somewhat","No Way","Not Sure","No Answer"),
                    Votes=c(0,4,1,2,1))
documentation<-data.frame(Answer=c("Fully","Somewhat","Not Much","Not Clue","No Answer"),
                    Votes=c(0,3,3,1,0))
controls<-data.frame(Answer=c("Legislation","Business","Rules","Risk","No Answer"),
                    Votes=c(5,6,3,5,0))
simulations<-data.frame(Answer=c("Definitely","Somewhat","No Way","Not Sure","No Answer"),
                    Votes=c(0,1,1,3,2))
automation<-data.frame(Answer=c("Yes","No"),
                    Votes=c(7,0))

tech_use<-c("AI","AI","excel","BI","Lucy","Recipe predict","Tableau","Cloud")

tech_challenges<-c("Time","Time","Time","Resistance","Time","People","Knowledge",
                   "People","People", "Excel", "Speed", "Data Availability", "Self Exp","Frequency")

strunstr<-data.frame(Answer=c("Definitely","Somewhat","Nope","No Clue","No Answer"),
                    Votes=c(3,2,2,0,0))
quality<-data.frame(Answer=c("Definitely","Somewhat","Nope","No Clue","No Answer"),
                    Votes=c(0,2,4,1,0))
sources<-data.frame(Answer=c("Definitely","Somewhat","Nope","No Clue","No Answer"),
                    Votes=c(2,4,1,0,0))

library(dplyr)
library(wordcloud)
library(highcharter)
library(tidyr)
library(d3wordcloud)
```

## Technology


### Tech Use


```{r}
tech_use<-as.data.frame(table(tech_use)) 

d3wordcloud(tech_use$tech_use, tech_use$Freq, colors = c("#000000", "#0000FF", "#FF0000"), rangesizefont = c(30, 50),color.scale="sqrt",rotate.min=0, rotate.max=0,spiral="rectangular")
```

### Challenges in Tech Adoption


```{r}
tech_challenges<-as.data.frame(table(tech_challenges)) 

d3wordcloud(tech_challenges$tech_challenges, tech_challenges$Freq, colors = c("#000000", "#0000FF", "#FF0000"), rangesizefont = c(20, 50),color.scale="sqrt",rotate.min=0, rotate.max=0,spiral="rectangular")
```

## People


```{r}
culture |> 
  rename(Culture=Votes) |> 
  bind_cols(training) |> 
  select(1,2,4) |> 
  rename(Answer=Answer...1, Training=Votes) |> 
  bind_cols(mentor) |> 
  select(-4) |> 
  rename(Answer=Answer...1, Mentor=Votes) |> 
  pivot_longer(!Answer,names_to = "Type",values_to = "values") |> 
  #pivot_wider(names_from = Answer, values_from = values)
  mutate(point=case_when(
    Answer=="Definitely" ~ 4,
    Answer=="Somewhat" ~ 3,
    Answer=="No Way" ~ 2,
    Answer=="Not Sure" ~ 1,
    Answer=="No Answer" ~ 0,
  )) |> 
  mutate(score=values*point) |> 
  group_by(Type) |> 
  summarise(score=sum(score)/sum(values)) |> 
  mutate(Max=4) |> 
  mutate(score=round(score*100/Max,2)) |> 
  ungroup() |> 
  arrange(score) |> 
  hchart("column", hcaes(x=Type, y=score), name="People",
         tooltip = list(pointFormat = "Avg. Score {point.Type}: {point.score}%"),
         dataLabels = list(enabled = TRUE, format= "{point.score}%")) |> 
  hc_yAxis(title = list(text = "Average Score (%)"),
           labels = list(format = "{value}%"), max = 100) |>
  hc_title(text = "Mentorship and Training needs a boost") |>
  hc_subtitle(text = "Average score from culture promotion and training and mentorship opportunities") |>
  hc_credits(enabled = TRUE,
             text = "LaNubia Data Science",
             href = "https://www.lanubia.com/") |>
  hc_tooltip() |>
  hc_add_theme(hc_theme_economist()) |> 
  hc_exporting(enabled = TRUE, # always enabled
               filename = "People")
```



## Data


```{r}

strunstr |> 
  rename(Data.Type=Votes) |> 
  bind_cols(quality) |> 
  select(1,2,4) |> 
  rename(Answer=Answer...1, Quality=Votes) |> 
  bind_cols(sources) |> 
  select(-4) |> 
  rename(Answer=Answer...1, Sources=Votes) |> 
  pivot_longer(!Answer,names_to = "Type",values_to = "values") |> 
  #pivot_wider(names_from = Answer, values_from = values)
  mutate(point=case_when(
    Answer=="Definitely" ~ 4,
    Answer=="Somewhat" ~ 3,
    Answer=="Nope" ~ 2,
    Answer=="No Clue" ~ 1,
    Answer=="No Answer" ~ 0,
  )) |> 
  mutate(score=values*point) |> 
  group_by(Type) |> 
  summarise(score=sum(score)/sum(values)) |> 
  mutate(Max=4) |> 
  mutate(score=round(score*100/Max,2)) |> 
  ungroup() |> 
  arrange(score) |> 
    hchart("column", hcaes(x=Type, y=score), name="Data",
         tooltip = list(pointFormat = "Avg. Score {point.Type}: {point.score}%"),
         dataLabels = list(enabled = TRUE, format= "{point.score}%")) |> 
  hc_yAxis(title = list(text = "Average Score (%)"),
           labels = list(format = "{value}%"), max = 100) |>
  hc_title(text = "Data quality is a major issue") |>
  hc_subtitle(text = "Average score from types of data used, its quality and sources") |>
  hc_credits(enabled = TRUE,
             text = "LaNubia Data Science",
             href = "https://www.lanubia.com/") |>
  hc_tooltip() |>
  hc_add_theme(hc_theme_economist()) |> 
  hc_exporting(enabled = TRUE, # always enabled
               filename = "Data")
```


## Process


```{r}


documentation |> 
  rename(Documentation=Votes) |> 
  bind_cols(simulations) |> 
  select(-3) |> 
  rename(Answer=Answer...1, Simulations=Votes) |> 
  pivot_longer(!Answer,names_to = "Type",values_to = "values") |> 
  #pivot_wider(names_from = Answer, values_from = values)
  mutate(point=case_when(
    Answer=="Fully" ~ 4,
    Answer=="Somewhat" ~ 3,
    Answer=="Not Much" ~ 2,
    Answer=="Not Clue" ~ 1,
    Answer=="No Answer" ~ 0,
  )) |> 
  mutate(score=values*point) |> 
  group_by(Type) |> 
  summarise(score=sum(score)/sum(values)) |> 
  mutate(Max=4) |> 
  mutate(score=round(score*100/Max,2)) |> 
  ungroup() |> 
  arrange(score) |> 
      hchart("column", hcaes(x=Type, y=score), name="Process",
         tooltip = list(pointFormat = "Avg. Score {point.Type}: {point.score}%"),
         dataLabels = list(enabled = TRUE, format= "{point.score}%")) |> 
  hc_yAxis(title = list(text = "Average Score (%)"),
           labels = list(format = "{value}%"), max = 100) |>
  hc_title(text = "Opportunity exists in Process Simulation and Documentation") |>
  hc_subtitle(text = "Average score from process documentation and simulations") |>
  hc_credits(enabled = TRUE,
             text = "LaNubia Data Science",
             href = "https://www.lanubia.com/") |>
  hc_tooltip() |>
  hc_add_theme(hc_theme_economist()) |> 
  hc_exporting(enabled = TRUE, # always enabled
               filename = "Process")


```


### Automation Opportunity


```{r}
automation |> 
  arrange(Votes) |> 
  hchart("column", hcaes(x=Answer, y=Votes), name="ProcessAutomation",
         tooltip = list(pointFormat = "Votes {point.Answer}: {point.Votes}"),
         dataLabels = list(enabled = TRUE, format= "{point.Votes}")) |> 
  hc_yAxis(title = list(text = "Count"),
           labels = list(format = "{value}")) |>
  hc_title(text = "Substantial Automation Opportunities Exist") |>
  hc_subtitle(text = "Count of votes (Whether or not process automation opportunities exist)") |>
  hc_credits(enabled = TRUE,
             text = "LaNubia Data Science",
             href = "https://www.lanubia.com/") |>
  hc_tooltip() |>
  hc_add_theme(hc_theme_economist()) |> 
  hc_exporting(enabled = TRUE, # always enabled
               filename = "ProcessAuto")
```


### Process Controls


```{r}
controls |> 
  arrange(Votes) |> 
  hchart("column", hcaes(x=Answer, y=Votes), name="ProcessControl",
         tooltip = list(pointFormat = "Votes {point.Answer}: {point.Votes}"),
         dataLabels = list(enabled = TRUE, format= "{point.Votes}")) |> 
  hc_yAxis(title = list(text = "Count"),
           labels = list(format = "{value}")) |>
  hc_title(text = "Process rules need boost") |>
  hc_subtitle(text = "Count of votes (Which controls exist)") |>
  hc_credits(enabled = TRUE,
             text = "LaNubia Data Science",
             href = "https://www.lanubia.com/") |>
  hc_tooltip() |>
  hc_add_theme(hc_theme_economist()) |> 
  hc_exporting(enabled = TRUE, # always enabled
               filename = "ProcessControl")
```










