Statistic <- c(68,85,74,88,63,78,90,80,58,63)
Math <- c(85,91,74,100,82,84,78,100,51,70)
colors <- c("yellow",
"gray")
plot(Statistic, Math,
pch = 20,
col = colors,
main="統計跟數學成績"
)

library(ggplot2)
ggplot(data = iris, aes(x = Sepal.Length)) +
geom_histogram(binwidth = 0.5, fill = "skyblue", color = "black") +
labs(title = "數學成績直方圖",
x = "數學成績",
y = "人數")

library(ggplot2)
data <- data.frame(
社團類型 = c("娛樂休閒", "知識開讀", "體育競技", "科學創新", "公益活動"),
次數 = c(180, 82, 36, 30, 25)
)
my_colors <- c("gray", "purple", "green", "pink", "black")
ggplot(data, aes(x = 社團類型, y = 次數, fill = 社團類型)) +
geom_bar(stat = "identity") +
scale_fill_manual(values = my_colors) +
theme_minimal(base_size = 15) +
labs(title = "大學生最喜歡參加的社團次數",
x = "社團類型",
y = "次數") +
theme(legend.position = "none")

library(ggplot2)
data <- data.frame(
社團類型 = c("娛樂休閒", "知識開讀", "體育競技", "科學創新", "公益活動"),
次數 = c(185, 82, 39, 36, 14)
)
my_colors <- c("gray", "purple", "green", "pink", "black")
ggplot(data, aes(x = "", y = 次數, fill = 社團類型)) +
geom_bar(stat = "identity", width = 1) +
coord_polar("y") +
scale_fill_manual(values = my_colors) +
theme_void(base_size = 15) +
labs(title = "大學生最喜歡參加的社團次數",
fill = "社團類型")

data <- data.frame(
社團類型 = c("娛樂休閒", "知識開讀", "體育競技", "科學創新", "公益活動"),
次數 = c(185, 82, 39, 36, 14)
)
my_colors <- c("gray", "purple", "green", "pink", "black")
ggplot(data, aes(x = 社團類型, y = 次數)) +
geom_segment(aes(x = 社團類型, xend = 社團類型,
y = 0, yend = 次數),
linewidth = 1.2, color = "gray40") +
geom_point(aes(color = 社團類型), size = 6) +
scale_color_manual(values = my_colors) +
theme_minimal(base_size = 15) +
labs(title = "大學生最喜歡參加社團次數",
x = "社團類型",
y = "次數") +
theme(legend.position = "none")

data <- read.csv("D:/table1_1.csv")
japanese_data <- data$Japanese
mean_japanese <- mean(japanese_data)
median_japanese <- median(japanese_data)
sd_japanese <- sd(japanese_data)
var_japanese <- var(japanese_data)
q1_japanese <- quantile(japanese_data, 0.25)
cat("平均數: ", mean_japanese, "\n")
## 平均數: 67.9
cat("中位數: ", median_japanese, "\n")
## 中位數: 62
cat("標準差: ", sd_japanese, "\n")
## 標準差: 16.25115
cat("變異數: ", var_japanese, "\n")
## 變異數: 264.1
cat("Q1 (25%): ", q1_japanese, "\n")
## Q1 (25%): 54.5