In [ ]:
library(ggplot2)
library(dplyr)
library(tidyr)
In [ ]:
options(repr.plot.width = 10, repr.plot.height = 6)
In [ ]:
df <- read.csv("data/cars.tidy.csv", stringsAsFactor = FALSE)
df$price_in_1000 = df$price / 1000
colnames(df)
In [ ]:
df <- filter(df, price < 1700000)
In [ ]:
head(df, 3)
In [ ]:
length(unique(df$name))
In [ ]:
str(df)
In [ ]:
ggplot(df, aes(engine)) + geom_histogram(binwidth = 300)
In [ ]:
ggplot(df, aes(seats)) + geom_bar(stat = "count")
In [ ]:
unique(df$type)
In [ ]:
colnames(df)
In [ ]:
ggplot(df,
aes(mileage_city, engine, color=fuel)) + geom_point()
In [ ]:
ggplot(filter(df, fuel == ' Petrol'),
aes(mileage_highway, engine, color=fuel)) + geom_point()
In [ ]:
ggplot(df,
aes(mileage_city, price_in_1000, color=engine)) + geom_point() + ylim(c(0,1500))
Price vs Mileage
In [ ]:
ggplot(df, aes(price, mileage_city)) + geom_point()
In [ ]: