Iterative Data Visualization

Row

Car Failure Analysis

Failure

Car failure in US

1624

Labor cost

Massachusetts

21

california

200

Texas

293

Florida

168

Row

Scatterplot

Top State

FM Vs Millage

Row

Failure by state

2nd page

Row

Boxplot

Map

Map

Data Table

Pivot Table

Summary

Column

Report

  • This is a report on 1624 car failures.

  • The average labor cost was 242.9180111.

  • The average material cost was 179.3948276.

This report was generated on September 13, 2021.

About Report

Created by:

Md Sojibul Islam

Department of Statistics

Mawlana Bhashani Science and Technology University

Tangail, Bangladesh.

Confidential: HIGHLY!

---
title: "Vehicle Failure Data Analysis Report"
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    vertical_layout: fill
    social: ["twitter","facebook","menu"]
    source_code: embed
    
---

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

```





```{r}
mydata<-read.csv("VehicleFailure.csv")
mycolor<-c("darkred","darkorange","blue","darkgreen","pink")

c<-c("blue", "#FFC125", "darkgreen", "darkorange")
attach(mydata)

```

Iterative Data Visualization
============================================

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


### Car Failure Analysis

```{r}

valueBox(paste("Failure"), color = "warning")

```


### Car failure in US

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

```


### **Labor cost**

```{r}

gauge(round(mean(mydata$lc),digits = 2),
      min = 0,
      max = 350,
      gaugeSectors(success = c(0,150),
                   warning = c(150,240),
                   danger = c(240,350),
                   colors = c("green","orange","red")))


```


### Massachusetts


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

```


### california


```{r}
#head(mydata$State)

valueBox(sum(mydata$State=="CA"),icon = "fab fa-amazon-pay")


```


### Texas


```{r}

valueBox(sum(mydata$State=="TX"),icon ="fas fa-dollar-sign" )

```



### Florida


```{r}

valueBox(sum(mydata$State=="FL"),icon ="fas fa-wrench" )

```












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


### Scatterplot 


```{r}
p4<-plot_ly(mydata,x=~fm) %>% 
  add_markers(y=~Mileage,text=~paste("Mileage:",Mileage))%>% 
  add_lines(y = ~fitted(loess(Mileage~fm)),name="loss Smoother",color=I("#FFC125"),
            line=list(width=5)) %>% 
  layout(xaxis=list(title="Month"),yaxis=list(title="Mileage"))

p4


```

### Top State


```{r}

p2<-mydata %>%
  group_by(State) %>% 
  summarise(count=n()) %>% 
  filter(count>50) %>% 
  plot_ly(labels=~State,
          values=~count,
          marker=list(color=c))%>%  
  add_pie(hole=0.2) %>% 
  layout(xasis=list(zeroline = F,
                    showline = F,
                    showticklabels = F,
                    showgrid = F),
         yaxis=list(zeroline = F,
                    showline = F,
                    showticklabels= F,
                    showgrid = F))
p2

```



### FM Vs Millage


```{r}

p3<- plot_ly(mydata, x=~fm,y=~Mileage,
             text=paste("FM:",mydata$fm,"Mileage:",mydata$Mileage),
             type = "bar") %>% layout(xaxis=list(title="FM"),yaxis=list(title="Failure Mileage"))
  
p3

```









Row
-------------------------------------
### Failure by state

```{r}


p1<-mydata %>% 
  group_by(State) %>% 
  summarise(count=n())%>%
  filter(count<100) %>% 
  plot_ly(x=~State,
          y=~count,
          type="bar",
          color = rainbow(48)) %>% 
  layout(xaxis=list(title="Failure by State"),yaxis=list(title="count"))
p1

```



2nd page
=========================================


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

### Boxplot


```{r}

p5<-mydata %>%
  group_by(State) %>% 
   ggvis(~State,~lc,fill=~State) %>%
  layer_boxplots()
p5
  


```





Map
========================================

### Map

```{r}


car <- mydata %>% 
  group_by(State) %>% 
  summarize(total=n()) 
  
car$State<-abbr2state(car$State)
  


highchart() %>% 
  hc_title(text="Car filure in Us") %>% 
  hc_subtitle(text="source: VehicleFailure.csv") %>% 
  hc_add_series_map(usgeojson,car,name="State",value = "total",
                    joinBy = c("woename","State")) %>% 
  hc_mapNavigation(enabled=T)
  
 
```




Data Table
========================================


```{r}
datatable(mydata,
          caption = "Failure Data",
          rownames = T,
          filter = "top",
          options = list(pageLength=25))


```




Pivot Table
=========================================

```{r}


rpivotTable(mydata,
            aggregatorName = "Count",
            cols="fm",
            rows = "State",
            rendererName = "Stacked Bar Chart"
           
            )


```



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


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

Report

* This is a report on `r length(mydata$fm)` car failures.

* The average labor cost was `r mean(mydata$lc)`.

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

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


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

Created by: 

**Md Sojibul Islam**

**Department of Statistics**

**Mawlana Bhashani Science and Technology University**

**Tangail, Bangladesh.**



Confidential: HIGHLY!