load library
library(ggplot2)
library(readxl)
library(ggthemes)
library(gridExtra)
Import Data
setwd("C:/Users/Dell 7490/Documents/statistika")
data <- read_excel("data_tren_penggunaan_ai.xlsx")
head(data)
## # A tibble: 6 × 8
## Industri `Jenis Pekerjaan` `Tingkat Penggunaan AI` `Respon terhadap AI`
## <chr> <chr> <chr> <chr>
## 1 Manufaktur Software Engineer Rendah Negatif
## 2 Keuangan Analis Keuangan Tinggi Positif
## 3 Teknologi Data Scientist Sedang Negatif
## 4 Teknologi Dosen Tinggi Positif
## 5 Teknologi Analis Keuangan Rendah Positif
## 6 Pendidikan Analis Keuangan Sedang Positif
## # ℹ 4 more variables: `Lama Bekerja (tahun)` <dbl>,
## # `Frekuensi Penggunaan AI per Minggu` <dbl>,
## # `Efisiensi Kerja Sebelum AI` <dbl>, `Efisiensi Kerja Sesudah AI` <dbl>
1. Pie Chart
pie_chart <- ggplot(data, aes(x = "", fill = Industri)) +
geom_bar(width = 1) +
coord_polar("y", start = 0) +
theme_minimal() +
labs(title = "Distribusi Industri") +
theme(axis.text.x = element_blank())
pie_chart

2. Bar Chart
bar_chart <- ggplot(data, aes(x = `Tingkat Penggunaan AI`, fill = `Tingkat Penggunaan AI`)) +
geom_bar() +
theme_minimal() +
labs(title = "Distribusi Tingkat Penggunaan AI", x = "Tingkat Penggunaan AI", y = "Frekuensi")
bar_chart

3. Dot Plot
dot_plot <- ggplot(data, aes(x = `Lama Bekerja (tahun)`, y = `Efisiensi Kerja Sebelum AI`)) +
geom_point(color = "blue", size = 2) +
theme_minimal() +
labs(title = "Dot Plot: Lama Bekerja vs. Efisiensi Sebelum AI", x = "Lama Bekerja (tahun)", y = "Efisiensi Sebelum AI")
dot_plot

4. Stem and Leaf Plot
stem(data$`Lama Bekerja (tahun)`)
##
## The decimal point is 1 digit(s) to the right of the |
##
## 0 | 11123344
## 0 | 5778889
## 1 | 4
## 1 | 7889
## 2 | 011233444
## 2 | 9
5. Histogram
histogram <- ggplot(data, aes(x = `Frekuensi Penggunaan AI per Minggu`)) +
geom_histogram(binwidth = 5, fill = "blue", color = "black", alpha = 0.7) +
theme_minimal() +
labs(title = "Histogram: Frekuensi Penggunaan AI per Minggu", x = "Frekuensi", y = "Jumlah Individu")
histogram

6. Boxplot
boxplot_data <- ggplot(data) +
geom_boxplot(aes(y = `Lama Bekerja (tahun)`, fill = "lama bekerja (tahun"), alpha = 0.6) +
theme_minimal() +
labs(title = "Boxplot: Lama Bekerja dalam tahun", fill = "Kondisi")
boxplot_data

7. Density Plot
density_plot <- ggplot(data, aes(x = `Efisiensi Kerja Sesudah AI`,fill = "Efisiensi")) +
geom_density(alpha = 0.5) +
theme_minimal() +
labs(title = "Density Plot: Efisiensi Kerja Sesudah AI", x = "Efisiensi", y = "Density")
density_plot

Menampilkan semua plot
grid.arrange(pie_chart, bar_chart, dot_plot, histogram, boxplot_data, density_plot, ncol = 2)
