cars <- read.csv("Car Sales.xlsx - car_data.csv")
nrow(cars)
## [1] 23906
set.seed(123)
sample_cars <- cars[sample(1:nrow(cars), nrow(cars)/2), ]
nrow(sample_cars)
## [1] 11953
summary(sample_cars$Price....)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 9000 18001 23001 28182 34001 85600
summary(sample_cars$Annual.Income)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 13500 390000 743000 834419 1190000 6800000
table(sample_cars$Body.Style)
##
## Hardtop Hatchback Passenger Sedan SUV
## 1465 3063 2010 2249 3166
Graphs
hist(sample_cars$Price...., main = "Distribution of Car Prices",
xlab = "Price ($)", col = "green")

library(ggplot2)
ggplot(sample_cars, aes(x = Body.Style)) +
geom_bar(fill = "orange") +
labs(title = "Cars Sold by Body Style", x = "Body Style", y = "Count")
