## Warning in plot.window(xlim, ylim, "", ...): "Math" 不是一個繪圖參數
## Warning in plot.window(xlim, ylim, "", ...): "Statistic" 不是一個繪圖參數
## Warning in title(main = main, sub = sub, xlab = xlab, ylab = ylab, ...): "Math"
## 不是一個繪圖參數
## Warning in title(main = main, sub = sub, xlab = xlab, ylab = ylab, ...):
## "Statistic" 不是一個繪圖參數
## Warning in axis(1, ...): "Math" 不是一個繪圖參數
## Warning in axis(1, ...): "Statistic" 不是一個繪圖參數
## Warning in axis(2, at = yt, ...): "Math" 不是一個繪圖參數
## Warning in axis(2, at = yt, ...): "Statistic" 不是一個繪圖參數

## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ lubridate 1.9.4     ✔ tibble    3.2.1
## ✔ purrr     1.0.4     ✔ tidyr     1.3.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors

japanese <- c(84,63,61,49,89,51,59,53,79,91)
stem(japanese)
## 
##   The decimal point is 1 digit(s) to the right of the |
## 
##   4 | 9
##   5 | 139
##   6 | 13
##   7 | 9
##   8 | 49
##   9 | 1
# 資料
japanese <- c(84, 63, 61, 49, 89, 51, 59, 53, 79, 91)

# 1. 平均數
mean_j <- mean(japanese)

# 2. 中位數
median_j <- median(japanese)

# 3. 眾數函數
get_mode <- function(x) {
  ux <- unique(x)
  tab <- tabulate(match(x, ux))
  modes <- ux[tab == max(tab)]
  return(modes)
}
mode_j <- get_mode(japanese)

# 4. 標準差
sd_j <- sd(japanese)

# 5. 變異數
var_j <- var(japanese)

# 6. 第一四分位數 Q1
q1_j <- quantile(japanese, 0.25)

# 7. 第三四分位數 Q3
q3_j <- quantile(japanese, 0.75)

# 顯示結果
cat("Mean:", mean_j, "\n")
## Mean: 67.9