score <- data.frame(
Statistic = c(68, 85, 74, 88, 63, 78, 90, 80, 58, 63),
Math = c(85, 91, 74, 100, 82, 84, 78, 100, 51, 70)
)
plot(
Math ~ Statistic,
data = score,
xlab = "Statistic Score",
ylab = "Math Score",
main = "Scatter Plot of Statistic vs Math",
pch = 16,
col = "#D3A4FF"
)

hist(
score$Math,
main = "Histogram of Math Scores",
xlab = "Math Score",
col = "#FFC1E0",
border = "black"
)

categories <- c("公益活動", "科學創新", "體育競技", "知識閱讀", "娛樂休閒")
counts <- c(8, 5, 7, 11, 20)
barplot(counts,
names.arg = categories,
main = "長條圖",
col = "#84C1FF",
ylab = "次數")

data <- data.frame(社團類型 = c("知識閱讀", "娛樂休閒", "體育競技", "公益活動", "科學創新"),
次數 = c(36, 82, 185, 25, 28))
my_colors <- c("#9393FF", "#AAAAFF", "#B9B9FF", "#CECEFF", "#DDDDFF")
pie(data$次數,labels = data$社團類型,main = "社團類型次數分配圓餅圖",col = my_colors)

plot(counts, type="h", lwd=11, col="#FFFF6F",
main="棒棒糖圖",
xlab="類別", ylab="頻數")
points(counts, pch=20, col="#FFFF6F")
axis(1, at=1:length(categories), labels=categories)

scores <- c(84, 63, 61, 49, 89, 51, 59, 53, 79, 91)
results <- list(
"Mean" = mean(scores),
"Median" = median(scores),
"SD" = sd(scores),
"Variance" = var(scores),
"Q1" = quantile(scores, 0.25)
)
print(results)
## $Mean
## [1] 67.9
##
## $Median
## [1] 62
##
## $SD
## [1] 16.25115
##
## $Variance
## [1] 264.1
##
## $Q1
## 25%
## 54.5