library(lattice)
library(latticeExtra)
library(readr)
library(readxl)
library(ggplot2)
##
## Attaching package: 'ggplot2'
## The following object is masked from 'package:latticeExtra':
##
## layer
data = read_xlsx("C:/Users/Tika/Downloads/car sales.xlsx")
data
## # A tibble: 23,906 × 16
## Car_id Date `Customer Name` Gender `Annual Income` Dealer_Name
## <chr> <dttm> <chr> <chr> <dbl> <chr>
## 1 C_CND… 2022-01-02 00:00:00 Geraldine Male 13500 Buddy Stor…
## 2 C_CND… 2022-01-02 00:00:00 Gia Male 1480000 C & M Moto…
## 3 C_CND… 2022-01-02 00:00:00 Gianna Male 1035000 Capitol KIA
## 4 C_CND… 2022-01-02 00:00:00 Giselle Male 13500 Chrysler o…
## 5 C_CND… 2022-01-02 00:00:00 Grace Male 1465000 Chrysler P…
## 6 C_CND… 2022-01-02 00:00:00 Guadalupe Male 850000 Classic Ch…
## 7 C_CND… 2022-01-02 00:00:00 Hailey Male 1600000 Clay Johns…
## 8 C_CND… 2022-01-02 00:00:00 Graham Male 13500 U-Haul CO
## 9 C_CND… 2022-01-02 00:00:00 Naomi Male 815000 Rabun Used…
## 10 C_CND… 2022-01-02 00:00:00 Grayson Female 13500 Rabun Used…
## # ℹ 23,896 more rows
## # ℹ 10 more variables: Company <chr>, Model <chr>, Engine <chr>,
## # Transmission <chr>, Color <chr>, `Price ($)` <dbl>, Dealer_No <chr>,
## # `Body Style` <chr>, Phone <dbl>, Dealer_Region <chr>
ggplot(data, aes(y = `Annual Income`, x = `Price ($)`)) +
geom_point()
ggplot(data = data, aes(x = `Price ($)`,
y = Dealer_Region,
fill = Dealer_Region)) +
geom_col() +
coord_flip() +
labs(
x = "price",
y = "region")
ggplot(data = data, aes(x = `Price ($)`,
y = Gender,
fill = Gender)) +
geom_col() +
coord_flip() +
labs(
x = "price",
y = "gender")
xyplot(`Annual Income` ~ `Price ($)`| Dealer_Region,
data = data,
layout = c(3,2),
col = "maroon")
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.