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("red",
            "skyblue")

plot(Statistic, Math,
     pch = 19,
     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(185, 82, 36, 28, 25)
)

my_colors <- c("#FF6F61", "#6B5B95", "#88B04B", "#F7CAC9", "#92A8D1")

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("#FF6F61", "#6B5B95", "#88B04B", "#F7CAC9", "#92A8D1")

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("#FF6F61", "#6B5B95", "#88B04B", "#F7CAC9", "#92A8D1")

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")

setwd("C:/Users/Xuan/Desktop")

data <- read.csv("table1_1.csv")   
x <- data$Japanese                 


cat("平均數 =", mean(x, na.rm = TRUE), "\n")
## 平均數 = 67.9
cat("中位數 =", median(x, na.rm = TRUE), "\n")
## 中位數 = 62
cat("標準差 =", sd(x, na.rm = TRUE), "\n")
## 標準差 = 16.25115
cat("變異數 =", var(x, na.rm = TRUE), "\n")
## 變異數 = 264.1
cat("Q1 (25%) =", quantile(x, 0.25, na.rm = TRUE), "\n")
## Q1 (25%) = 54.5