Sales Summary


This dashboard is created using HTML, CSS, and the data is pulled, prepared, and visualized using R.

This is for demonstration purposes only. The data used is pulled from a public source, specifically the GoodCarBadCar website - https://www.goodcarbadcar.net/ford-motor-company-us-sales-figures/.


Ford Sales by Year

Sales V. Prior Year

Raw Data

Year Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2005 183379 234208 281906 260741 263949 265698 343768 266798 209587 182417 185852 244989
2006 189817 226291 268123 242877 256755 246815 221491 235920 220877 198130 164170 212703
2007 151416 194310 243541 209694 239579 228376 177167 200401 173554 179652 166565 191729
2008 145435 181808 209714 185434 200372 163769 154527 150006 114519 126600 116756 132247
2009 89085 94035 122605 126385 153437 144357 157198 175274 107811 131211 117212 176061
2010 110716 134925 174949 160928 188793 168328 165019 156090 158613 156181 145367 188825
2011 125141 153513 209439 186725 189137 190540 178822 173573 172788 165484 164659 206790
2012 135532 352164 220491 175919 212089 205206 172396 195808 172359 166957 175880 210876
2013 164777 193462 233409 208787 242860 233538 192212 219574 183176 189554 187642 214504
2014 152292 181996 241475 207700 249574 219741 210519 221024 179335 187809 186255 219225
2015 177382 179648 234774 221603 250077 224671 222009 233879 221261 213103 186822 237606
2016 172398 216792 253064 229739 234748 239096 215268 213410 203444 187692 196441 237785
2017 171186 207464 234895 213436 240250 227166 199318 209029 221643 199698 210205 240910
2018 160411 194062 243021 208109 241527 229537 192743 217700 196496 191682 195255 219632
2019 188882 185353 208523 209639 241889 187511 189476 212214 174317 197153 204431 197144
2020 167146 216395 131072 77815 172928 181572 192536 171144 185405 181820 148816 0
---
title: "Dashboard by Ryan Pierce"
date: "As of `r format(Sys.time(), '%B %d, %Y')`"
output:
  flexdashboard::flex_dashboard:
    navbar:
        - { icon: "fa-envelope", href: "mailto:r.pierce521@gmail.com", align: right }
        - { icon: "fa-linkedin", href: "https://www.linkedin.com/in/ryan-a-pierce", align: right }
        - { icon: "fa-github", href: "https://github.com/ryanapierce", align: right }
        - { icon: "fa-window-restore", href: "https://ryanapierce.github.io", align: right }
    logo: logo.png
    source_code: embed
  orientation: rows
  vertical_layout: fill
---
  

  
```{r setup, include=FALSE}
library(flexdashboard)
library(knitr)
library(plotly)
library(leaflet)
library(readxl)
library(tidyverse)
library(dplyr)
library(lemon)
knit_print.data.frame <- lemon_print
```

```{r}
rawdata <- read_excel("R_Assets/Sample_Ford_Data.xlsx")
data <- select(rawdata, -1)
Values <- rowSums(data)
YRdata <- data.frame("Year" = c(2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020))
TotalData <- cbind(Values, YRdata)

newdata <- rawdata[-c(1:14), ] 

```
Sales Summary
=====================================

-------------------------------------

This dashboard is created using HTML, CSS, and the data is pulled, prepared, and visualized using R.  

This is for demonstration purposes only. The data used is pulled from a public source, specifically the GoodCarBadCar website - https://www.goodcarbadcar.net/ford-motor-company-us-sales-figures/.

-------------------------------------
  
### Ford Sales by Year
  
```{r}
lineg <- plot_ly(x = TotalData$Year, y = TotalData$Values, mode = 'lines')

fig <- lineg %>% layout(title = 'US Sales per Year',
         xaxis = list(title = 'Year'),
         yaxis = list (title = 'Sales ($)'))
fig
```

### Sales V. Prior Year

```{r}
prior <- newdata[1,2:13]
current <- newdata[2,2:13]

Mdata <- data.frame("Month" = c("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"))

prior_transpose <- as.data.frame(t(as.matrix(prior)))
colnames(prior_transpose) <- "values"
PriorData <- cbind(prior_transpose, Mdata)

current_transpose <- as.data.frame(t(as.matrix(current)))

colnames(current_transpose) <- "values"
CurrentData <- cbind(current_transpose, Mdata)

linem <- plot_ly(x = PriorData$Month, y = PriorData$values, type = 'scatter', name = '2019', mode = 'lines')
linem <- linem %>% add_trace(y = CurrentData$values, name = '2020', mode = 'lines')

fig <- linem %>% layout(title = 'US Sales V Prior Year',
         xaxis = list(title = 'Month',
                      categoryorder = "array",
                      categoryarray = PriorData$Month),
         yaxis = list (title = 'Sales ($)'))

fig
```

Raw Data
======================================
  
```{r}
kable(rawdata)
```