Statisti <- 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("#CECEFF",
"#5CADAD")
plot(Statisti,Math,
pch = 19,
col = colors)

# 畫統計成績直方圖
hist(Statisti,
breaks = 5, # 分成 5 個區間
col = "#FF9797", # 顏色
main = "統計成績直方圖",
xlab = "分數",
ylab = "人數")

# 畫數學成績直方圖
hist(Math,
breaks = 5,
col = "#FFDAB9",
main = "數學成績直方圖",
xlab = "分數",
ylab = "人數")

categories <- c("公益活動", "科學創新", "體育競技", "知識閱讀","娛樂休閒")
counts <- c(25, 28, 36, 82,185)
barplot(counts, names.arg=categories, main="大學生最喜歡參加的社團", col="#64A600", border="#5A5AAD")

labels <- c("公益活動", "科學創新", "體育競技", "知識閱讀", "娛樂休閒")
counts <- c(25, 28, 36, 82, 185)
pie(counts,
labels = labels,
main = "學生參加社團類型比例"
)

col =c("#FFE153","#FF9D6F","#C4E1E1","#96FED1","#CECEFF")
categories <- c("公益活動", "科學創新", "體育競技", "知識閱覽", "娛樂休閒")
counts <- c(25, 28, 36, 82, 185)
x_pos <- 1:length(counts)
plot(x_pos, counts, type = "n", xaxt = "n", xlab = "", ylab = "人數",
main = "大學生最喜歡參加的社團")
segments(x0 = x_pos, y0 = 0, x1 = x_pos, y1 = counts, lwd = 3)
points(x_pos, counts, pch = 19, cex = 2, col = "#00AEAE")
axis(1, at = x_pos, labels = categories)

# 建立數據向量
scores <- c(84, 63, 61, 49, 89, 51, 59, 53, 79, 91)
# 平均數
mean_score <- mean(scores)
# 中位數
median_score <- median(scores)
# 標準差
sd_score <- sd(scores)
# 變異數
var_score <- var(scores)
# 第 1 四分位數 (Q1)
Q1 <- quantile(scores, 0.25)
# 顯示結果
mean_score
## [1] 67.9
median_score
## [1] 62
sd_score
## [1] 16.25115
var_score
## [1] 264.1
Q1
## 25%
## 54.5