Memanggil Data External (.csv)
data_customer <- read_csv("C:/Users/MUTHI'AH IFFA/Downloads/Semester 4/Visualisasi Data/customer data.csv")
## Rows: 30 Columns: 8
## āā Column specification āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
## Delimiter: ","
## chr (6): first_name, gender, visit, credit card type, product, total purchase
## dbl (2): id, credit card id
##
## ā¹ Use `spec()` to retrieve the full column specification for this data.
## ā¹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
data_customer
## # A tibble: 30 Ć 8
## id first_name gender visit `credit card id` `credit card type` product
## <dbl> <chr> <chr> <chr> <dbl> <chr> <chr>
## 1 1 Kara-lynn Del⦠Bigen⦠12/1⦠3.57e15 jcb Sauce ā¦
## 2 2 Anderea Fisk Female 20/1⦠3.56e15 jcb V8 Pet
## 3 3 Twyla Durrand Female 6/1/⦠3.58e15 jcb C - Plā¦
## 4 4 Cristabel Mor⦠Female 7/1/⦠3.55e15 jcb Calypsā¦
## 5 5 Tiffanie Pyke⦠Female 23/1⦠3.04e13 diners-club-carte⦠Juice ā¦
## 6 6 Edlin Pitrelli Non-b⦠4/1/⦠3.62e13 diners-club-inter⦠Pomello
## 7 7 Margette Metz⦠Female 8/1/⦠3.56e15 jcb Energyā¦
## 8 8 Gus Trayford Female 13/1⦠3.54e15 jcb Juice ā¦
## 9 9 Nikolos Le Br⦠Male 19/1⦠4.94e17 switch Beer -ā¦
## 10 10 Melanie South⦠Female 6/1/⦠3.54e15 jcb Plate ā¦
## # ā¹ 20 more rows
## # ā¹ 1 more variable: `total purchase` <chr>
Penerapan Data Kategori dengan Mengekstrak Kode dari essquisse
Diagram Batang
ggplot(data_customer) +
aes(x = `credit card type`) +
geom_bar(fill = "#0C4C8A") +
labs(
x = "credit type",
y = "amount",
title = "CUSTOMER'S CREDIT TYPE"
) +
coord_flip() +
theme_minimal() +
theme(
axis.text.y = element_text(face = "bold",
size = 12L),
axis.text.x = element_text(face = "bold")
)

Heatmap
ggplot(data_customer) +
aes(x = `credit card type`, fill = visit) +
geom_bar() +
scale_fill_viridis_d(option = "plasma", direction = 1) +
labs(
x = "credit card type",
y = "amount",
title = "CUSTOMER'S VISIT BY CREDIT CARD"
) +
theme_minimal() +
theme(
axis.text.y = element_text(face = "bold"),
axis.text.x = element_text(face = "bold",
size = 6L,
angle = 10L)
)
