Data <- read.csv("D:/table1_1.csv")


Data
##      Name Statistic Math Japanese Management Accounting
## 1  張青松        68   85       84         89         86
## 2  王奕翔        85   91       63         76         66
## 3  田新雨        74   74       61         80         69
## 4  徐麗娜        88  100       49         71         66
## 5  張志傑        63   82       89         78         80
## 6  趙穎睿        78   84       51         60         60
## 7  王智強        90   78       59         72         66
## 8  宋媛婷        80  100       53         73         70
## 9  袁四方        58   51       79         91         85
## 10 張建國        63   70       91         85         82
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(Statistic,Math,
     pch = 17,
     col= "skyblue",
     main ="班上的統計與數學成績",
     xlab ="Statistic",
     ylab ="Math")

hist(Math,
     col= "lightyellow",
     main ="班上的數學成績",
     xlab ="數學成績",
     ylab ="次數")

# Load ggplot2
library(ggplot2)

# Create data
data <- data.frame(
  a=c("娛樂休閒","知識閱讀","體育競技","科學創新","公益活動") ,  
  value=c(185,82,36,28,25)
  )

# Barplot
ggplot(data, aes(x=a, y=value)) + 
  geom_bar(stat = "identity")

a<- c(185,82,36,28,25)
labels <- c("娛樂休閒","知識閱讀","體育競技","科學創新","公益活動")

pie(a,labels,main ="學生的比例", col=heat.colors(length(a)))

# Library
library(tidyverse)
## ── 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
# Create data
data <- data.frame(
  name = c("娛樂休閒", "知識閱讀", "體育競技", "科學創新", "公益活動"),
  score = c(185, 82, 36, 28, 25)
)
 
# Plot
ggplot(data, aes(x = name, y = score)) +
  geom_segment(aes(x = name, xend = name, y = 0, yend = score)) +
  geom_point(size = 5, color = "red", fill = alpha("orange", 0.3), alpha = 0.7, shape = 21, stroke = 2) +
  theme_minimal() +
  labs(title = "活動類別得分圖", x = "活動類別", y = "得分") +
  theme(axis.text.x = element_text(angle = 0, hjust = 1))

Data <- read.csv("D:/table1_1.csv")


Data
##      Name Statistic Math Japanese Management Accounting
## 1  張青松        68   85       84         89         86
## 2  王奕翔        85   91       63         76         66
## 3  田新雨        74   74       61         80         69
## 4  徐麗娜        88  100       49         71         66
## 5  張志傑        63   82       89         78         80
## 6  趙穎睿        78   84       51         60         60
## 7  王智強        90   78       59         72         66
## 8  宋媛婷        80  100       53         73         70
## 9  袁四方        58   51       79         91         85
## 10 張建國        63   70       91         85         82
stem(Data$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
mean(Data$Japanese)  
## [1] 67.9
median(Data$Japanese)
## [1] 62
as.numeric(names(table(Data$Japanese)))[which.max(table(Data$Japanese))] 
## [1] 49
sd(Data$Japanese)
## [1] 16.25115
var(Data$Japanese)
## [1] 264.1
Q1 <- quantile(Data$Japanese, 1 / 4)
Q3 <- quantile(Data$Japanese, 3 / 4)

Q1
##  25% 
## 54.5
Q3
##   75% 
## 82.75