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="violet",
main="班上的統計成績",
xlab="Statistic",
ylab="Math")
# Add grid lines
grid()

Math <- c(85, 91, 74, 100, 82, 84, 78, 100, 51, 70)
hist(
Math,
main = "數學成績",
xlab = "數學",
ylab = "人數",
col = "lightyellow",
border = "black",
)
# Add grid lines
grid()

category <- c("娛樂休閒", "知識閱讀", "體育競技", "科學創新", "公益活動")
count <- c(185, 82, 36, 28, 25)
barplot(count, names.arg = category,
col = "lightpink",
main = "大學生最喜歡參加的社團的次數分配表",
xlab = "社團類型",
ylab = "次數",
cex.names = 1,
cex.axis = 1.3,
cex.main = 1.2,
cex.lab = 1.3,
las = 2.5,
border = "lightblue",
font.main = 2.5)

data <- c(185, 82, 36, 28, 25)
labels <- c("娛樂休閒", "知識閱讀", "體育競技", "科學創新", "公益活動")
colors <- c("pink", "purple", "white", "lightblue", "lightyellow")
pie(data, labels = labels,
main = "大學生最喜歡參加的社團的次數分配表",
col = colors,
cex.main = 1,
cex.lab = 1.5,
cex = 1.3,
font.main = 2.5,
radius = 1 )
# Add grid lines
grid()

data <- data.frame(
Name = c("張青松", "王奕翔", "田新雨", "徐麗娜", "張志傑",
"趙穎睿", "王智強", "宋媛婷", "袁四方", "張建國"),
Statistic = c(68, 85, 74, 88, 63, 78, 90, 80, 58, 63),
Math = c(85, 91, 74, 100, 82, 84, 78, 100, 51, 70),
Japanese = c(84, 63, 61, 49, 89, 51, 59, 53, 79, 91),
Management = c(89, 76, 80, 71, 78, 60, 72, 73, 91, 85),
Accounting = c(86, 66, 69, 66, 80, 60, 66, 70, 85, 82)
)
stem(data$Japanese, scale = 1)
##
## 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(68, 85, 74, 88, 63, 78, 90, 80, 58, 63)
mean(japanese)
## [1] 74.7
median(japanese)
## [1] 76
get_mode <- function(x) {
uniq_x <- unique(x)
uniq_x[which.max(tabulate(match(x, uniq_x)))]
}
get_mode(japanese)
## [1] 63
sd(japanese)
## [1] 11.32402
var(japanese)
## [1] 128.2333
quantile(japanese, 0.25)
## 25%
## 64.25
quantile(japanese, 0.75)
## 75%
## 83.75
par(family = "serif", cex = 2.1)