1st we learned basic data wrangling concepts: Import>Tidy>Transform. This is training in “how to work with data”, the “why”; R is merely the tool or the “how”.


I’m training in using R data science methodologies for the ENTIRE business analytics workflow.

A Business Intelligence Analytics program I’m in at a major California University consisted of the following coursework:

Very early in the 9 month program I realized this course work, while a start, was not comprehensive enough for me to complete my career transition from tech sales into data focused employment.

I was planning on specializing in Tableau, until I came across Matt Dancho and Business Science U.

Thanks to Matt for creating this approach, which has changed my training 100%.

More information here:

https://www.business-science.io/business/2017/12/27/six-reasons-to-use-R-for-business.html

2nd we learned basic visualizations. Point & Scatter Plots used for plotting Continuous vs Continuous variables.


Goal: To explain the relationship between order value and quantity of bikes sold.

The Line Plot


Goal: Describe revenue by month, expose cyclic nature of sales.

The Bar Chart


Goal: Sales by Descriptive Category

Next Installment: The Histogram, Density Plot, Box Plot and Violin Plot


Read more about the 6 reasons at below link:

https://www.business-science.io/business/2017/12/27/six-reasons-to-use-R-for-business.html

---
title: "Common Business Charts"
output: 
  flexdashboard::flex_dashboard:
    storyboard: true
    source: embed
    social: menu
---

```{r include = FALSE}
library(flexdashboard)
library(tidyverse)
library(lubridate)
library(tidyquant)

bike_orderlines_tbl <- read_rds("../00_flexdashboard/bike_orderlines.rds")
```

### 1st we learned basic data wrangling concepts: Import>Tidy>Transform. This is training in "how to work with data", the "why"; R is merely the tool or the "how".
![](../images/Capture.JPG)

***
I'm training in using R data science methodologies for the ENTIRE business analytics workflow.

A Business Intelligence Analytics program I'm in at a major California University consisted of the following coursework: 

- BI (in a silo) 
- Tableau (in a silo) 
- Advanced Excel (in a silo)
- SQL (in a silo) 
- R or Python (in a silo)

Very early in the 9 month program I realized this course work, while a start, was not comprehensive enough for me to complete my career transition from tech sales into data focused employment.

I was planning on specializing in Tableau, until I came across Matt Dancho and Business Science U. 

Thanks to Matt for creating this approach, which has changed my training 100%.

More information here: 

https://www.business-science.io/business/2017/12/27/six-reasons-to-use-R-for-business.html

### 2nd we learned basic visualizations. Point & Scatter Plots used for plotting Continuous vs Continuous variables. 

```{r}

# Data Manipulation
order_value_tbl <- bike_orderlines_tbl %>% 
    
    select(order_id, order_line, total_price, quantity) %>% 
    group_by(order_id) %>% 
    summarise(
        `Total Quantity: Bikes` = sum(quantity),
        `Total Price`           = sum(total_price)
    ) %>% 
    ungroup() 
  
# Scatter Plot
order_value_tbl %>% 
    
    ggplot(aes(x = `Total Quantity: Bikes`, y = `Total Price`)) +
    geom_point(alpha = 0.5, size = 2) +
    geom_smooth(method = "lm", se = FALSE) +
    scale_y_continuous(labels = scales::dollar_format()) +
    theme_tq() 

```

***
Goal: To explain the relationship between order value and quantity of bikes sold. 

- I love the summarise function where I can create new columns and text names for the plot in one line of code. (line 60, 61 in Source Code, top right icon)

### The Line Plot

```{r}
revenue_by_month_tbl <- bike_orderlines_tbl %>% 
  
    select(order_date, total_price) %>% 
    
    mutate(`Year - Month` = floor_date(order_date, "months") %>%  ymd()) %>% 
    
    group_by(`Year - Month`) %>% 
    summarise(Revenue = sum(total_price)) %>% 
    ungroup()

# Line Plot
revenue_by_month_tbl %>% 
    
    ggplot(aes(x = `Year - Month`, y = Revenue)) +
    geom_line(size = 0.5, linetype = 1) +
    geom_smooth(span = 0.2, method = "loess", se = F) +
    scale_y_continuous(labels = scales::dollar_format(scale = 1e-6, suffix = "M")) +
    theme_tq()

```

***
Goal: Describe revenue by month, expose cyclic nature of sales.

 - Used for time series analysis.
 
 - I'm going to have to examine why I don't have months on my x-axis.

### The Bar Chart

```{r}
# Data Manipulation
revenue_by_category_2_tbl <- bike_orderlines_tbl %>% 
    select(category_2, total_price) %>% 
    group_by(category_2) %>% 
    summarise(Revenue = sum(total_price)) %>% 
    ungroup()

# Bar Plot
revenue_by_category_2_tbl %>% 
    
    mutate(`Bike Category 2` = category_2 %>% as_factor() %>% fct_reorder(Revenue)) %>% 
    ggplot(aes(`Bike Category 2`, Revenue)) +
    geom_col(fill = "#2c3e50") +
    scale_y_continuous(labels = scales::dollar_format(scale = 1e-06, suffix = "M")) +
    coord_flip() +
    theme_tq()

```

***
Goal: Sales by Descriptive Category

- Love how I could change the scientific notated revenue to M$ with the scale_y_continous function. (Before coord_flip on line 130 in source code)

- The "new" x_scale needs to be adjusted as the "$20M" is clipped.

### Next Installment: The Histogram, Density Plot, Box Plot and Violin Plot

![](../images/Capture_6_reasons.JPG)

***
Read more about the 6 reasons at below link:

https://www.business-science.io/business/2017/12/27/six-reasons-to-use-R-for-business.html