======================================================================
======================================================================
[1] -0.8014562
[1] -0.7705439
[1] 0.8081388
[1] -0.6857513
[1] -0.6975991
# PLOTS {.tabset}
count of cars
---
title: "ANALYSIS ON ATTRIBUTES WHICH INFLUENCES CARS"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
theme: darkly
storyboard: yes
social: menu
source_code: embed
html_document:
df_print: paged
---
```{r setup, include=FALSE}
libraries= c("flexdashboard","lattice","DT","ggplot2")
lapply(libraries,require,character.only=TRUE)
data=read.csv(file.choose())
new_data<-data[c("CarName","fueltype","drivewheel","cylindernumber","horsepower","citympg","highwaympg","price")]
attach(data)
```
# INTRODUCTION {.tabset}
### Exploring Data
### The dataset about car price prediction was downloaded from kaggle.
### It was then read into R cloud and further the following analysis were done - subsetting, outliers detection, Grammar of graphics plots such as histogram,boxplot and scatter plot analysis.
### The initial assumptions are as follows:
### Higher the horsepower, more the number of cylinders
### Higher the horsepower, lower the mpg
### There exists a strong correlation between horsepower and price
### Fuel type determines the mileage to some extent
======================================================================
======================================================================
# MENU {.tabset}
### Structure
```{r}
str(data)
```
### SUMMARY
```{r}
summary(data)
```
# CORRELATION {.tabset}
### Correlation factors
```{r}
cor(horsepower,citympg)
cor(horsepower,highwaympg)
cor(horsepower,price)
cor(citympg,price)
cor(highwaympg,price)
```
# HISTOGRAM {.tabset}
### Comparison of attributes
```{r}
hist(new_data$price,main="PRICE FREQUENCY")
hist(new_data$citympg,main="MILEAGE IN CITY ROADS")
hist(new_data$highwaympg,main="MILEAGE IN HIGHWAYS")
hist(new_data$horsepower,main="HORSEPOWER OF THE CARS")
```
-----------------------------------------------------------------------
### HORSEPOWER
```{r}
histogram(~horsepower|drivewheel,data=new_data)
histogram(~horsepower|cylindernumber,main="HORSEPOWER VS CYLINDERS")
```
### FUEL TYPE
```{r}
histogram(~citympg|fueltype,main="CITY MPG VS FUEL")
histogram(~highwaympg|fueltype,main="HIGHWAY MPG VS FUEL")
```
### CYLINDER NUMBER
```{r}
histogram(~price|cylindernumber,main="CYLINDERS VS PRICE")
histogram(~horsepower|cylindernumber,main="HORSEPOWER VS CYLINDERS")
```
# BOXPLOT {.tabset}
# Analysis {.tabset}
-------------------------------------------------------------------
------------------------------
### HORSE POWER AND PRICE
```{r}
ggplot(new_data)+geom_boxplot(aes(x=horsepower,y=price,fill=horsepower))+ggtitle('BOXPLOT OF HORSEPOWER AND PRICE')+xlab('HORSEPOWER')+ylab('PRICE')
```
### PRICE AND CYLINDER NUMBER
```{r}
ggplot(new_data)+geom_boxplot(aes(x=price,y=cylindernumber,fill=price))+ggtitle('BOXPLOT OF PRICE AND CYLINDER NUMBERS')+xlab('PRICE')+ylab('CYLINDERNUMBERS')
```
### HORSE POWER AND CYLINDER
```{r}
ggplot(new_data)+geom_boxplot(aes(x=horsepower,y=cylindernumber,fill=horsepower))+ggtitle('BOXPLOT OF HORSEPOWER AND CYLINDERS')
```
### HORSEPOWER AND DRIVEWHEEL
```{r}
ggplot(new_data)+geom_boxplot(aes(x=horsepower,y=drivewheel,fill=horsepower))+ggtitle('BOXPLOT OF HORSEPOWER AND DRIVEWHEEL')
```
### HORSEPOWER AND FUELTYPE
```{r}
ggplot(new_data)+geom_boxplot(aes(x=horsepower,y=fueltype,fill=horsepower))+ggtitle('BOXPLOT OF HORSEPOWER AND FUELTYPE')
```
# PLOTS {.tabset}
### Simple Plots
```{r}
ggplot(new_data)+geom_point(aes(x=horsepower,y=price))
ggplot(new_data)+geom_point(aes(x=price,y=cylindernumber))
ggplot(new_data)+geom_point(aes(x=horsepower,y=cylindernumber))
ggplot(new_data)+geom_point(aes(x=horsepower,y=citympg))
ggplot(new_data)+geom_point(aes(x=horsepower,y=highwaympg))
ggplot(new_data)+geom_point(aes(x=horsepower,y=drivewheel))
ggplot(new_data)+geom_bar(aes(x=horsepower,stat="bin",binwidth=0.05))
```
# DATATABLE {.tabset}
### Valuebox
```{r}
value=sum(car_ID)
valueBox("count of cars",value,icon="fa fa-user")
```
### DOWNLOAD
```{r}
datatable(data,extensions='Buttons',options=list(dom="Bftrip",Buttons=c('copy','print','csv','pdf')))
```
# INSIGHTS {.tabset}
### Inferences observed
### There exists a strong correlation between hosrepower and price of the car.
### cor=0.8014562-- Thus both the factors are highly influencing factors. Higher the horsepower, higher the price of the vehicles.
### Horsepower in front wheel drive(fwd) is maximum.
### Diesel vehicles exhibit slightly greater city and highway mileage than gas vehicles.
### Average and idle number of cylinders lies in the range of 4-6.
### Mileage in city as well as highways reduces with increase in horsepower.
### The ideal price of the car with good mileage and horsepower can be between 20000 to 30000.