Interactive Visualization

Row

Car Failure Analysis.

Failure warning

Car Failure in US

1624

Labor Cost

Massachusetts

21

California

200

Texas

293

Florida

168

Row

State With Minimum Failure

Top 5 States

Row

FM vs Mileage

Scatter Plot of Month vs Mileage

Map

Map

DATA TABLE

Pivot Table

Summary

column

Max Failure Month

23

Average Labour cost

242.92

Average Mileage at Failure

20578.67

Column

Report

  • This report on 1624 car failures.

  • The average labour cost was 242.9180111.

  • The average material cost was 179.3948276.

This report was generated on July,24,2024.

About Report

Created by: Analyst Julius

---
title: "CAR ANALYSIS DASHBOARD"
output: 
  flexdashboard::flex_dashboard:
    css: styles.css
    theme: default
    orientation: rows
    vertical_layout: scroll
    source_code: embed
    social: ["menu"]
---

```{r setup, include=FALSE}
library(flexdashboard)
library(knitr)
library(DT)
library(rpivotTable)
library(tidyverse)
library(plotly)
library(openintro)
library(highcharter)

```




```{r, include=FALSE}
data <- read.csv("vehicle.csv")
str(data)
```


Interactive Visualization
=====================================================

Row
------------------------------------------------------

### Car Failure Analysis.

```{r}
valueBox(paste("Failure",
               color = "warning"))
```



### Car Failure in US

```{r}
valueBox(length(data$State),
         icon = "fa-user")
```



### Labor Cost

```{r}
gauge(round(mean(data$lc),
            digits = 2),
            min = 0,
            max = 350,
            gaugeSectors(success = c(0,150),
                         warning = c(150,240),
                         danger = c(240,350),
                         colors = c('green', 'yellow', 'red')))
```



### Massachusetts

```{r}
valueBox(sum(data$State=="MA"),
         icon = "fa-building")
```

### California

```{r}
valueBox(sum(data$State == "CA"),
         icon = "fa-building")
```


### Texas

```{r}
valueBox(sum(data$State == "TX"),
         icon = "fa-building")
```


### Florida

```{r}
valueBox(sum(data$State == "FL"),
         icon = "fa-building")
```


Row
------------------------------------------------------

### State With Minimum Failure

```{r}
p1 <- data %>% 
  group_by(State) %>% 
  summarise(count = n()) %>% filter(count <= 20 &  count > 1) %>% 
  ggplot(aes(State,count, fill = State))+geom_col()+
  theme_classic()+theme(legend.position = "none")+
  labs(title = "Failure By State",
       caption = "** By Julius**")
ggplotly(p1)
```


### Top 5 States
```{r}
p2 <- data %>% 
  group_by(State) %>% 
  summarise(count = n()) %>% 
  filter(count>50) %>% 
  plot_ly(labels = ~State,
          values = ~count) %>% 
  add_pie(hole = 0.4)
p2
```


Row
--------------------------------------------------------

### FM vs Mileage

```{r}
p3 <- data %>% 
  ggplot(aes(fm, Mileage))+geom_col(fill = "blue")+theme_classic()
ggplotly(p3)
```


### Scatter Plot of Month vs Mileage

```{r}
p4 <- data %>% 
  ggplot(aes(fm, Mileage))+geom_point()+geom_smooth(se = FALSE, color ="blue")
ggplotly(p4)
```



Map
=====================================================
### Map

```{r}
car <- data %>% 
  group_by(State) %>% 
  summarize(total = n())
car$State <- abbr2state(car$State)
highchart() %>% 
  hc_title(text = "Car Failure in US") %>% 
  hc_subtitle(text = "source: vehicle failure.csv") %>% 
  hc_add_series_map(usgeojson, car,
                    name = "State",
                    value = "total",
                    joinBy = c("woename", "State")) %>% 
  hc_mapNavigation(enabled = T)
```

DATA TABLE
============================================================
```{r}
datatable(data,
          caption = "Failure data",
          rownames = T,
          filter = "top",
          options = list(pagelength = 25))
```

Pivot Table
============================================================
```{r}
rpivotTable(data,
            aggregatorName = "count",
            cols = "fm",
            rows = "State",
            rendererName = "Heatmap")
```



Summary {data-orientation=columns}
===================================================================

column
----------------------------------------------

### Max Failure Month


```{r}
valueBox(max(data$fm),
         icon = "fa-user")
```


### Average Labour cost

```{r}
valueBox(round(mean(data$lc),digits = 2),
         icon = "fa-area-chart")
```


### Average Mileage at Failure

```{r}
valueBox(round(mean(data$Mileage),digits = 2),
         icon = "fa-area-chart")
```



Column
----------------------------------------------------------------


Report


* This report on `r length(data$fm)` car failures.

* The average labour cost was `r mean(data$lc)`.

* The average material cost was `r mean(data$mc)`.

This report was generated on `r format(Sys.Date(), format = " %B,%d,%Y")`.





About Report
==========================================================

Created by: Analyst Julius