統計成績 <- c(68,85,74,88,63,78,90,80,58,63)
數學成績 <- c(85,91,74,100,82,84,78,100,51,70)
plot(統計成績,數學成績,
pch=17,
col="pink",
xlab="統計成績",
ylab="數學成績",
main="班上的統計成績數學成績",
cex.lab=1.5,
cex.main=1.5,
cex.axis=1.5
)

hist(統計成績,
col= "gray",
xlab ="統計成績",
ylab ="次數",
main ="班上的統計成績",
cex.lab=1.5,
cex.main=1.5,
cex.axis=1.5
)

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

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

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)