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)

plot(Statistic,
pch=17,
col="gray",
xlab="統計成績",
ylab="數學成績",
main="班上的統計與數學成績")

hist(Statistic,
col= "pink",
main ="班上的統計成績",
xlab ="統計成績",
ylab ="人數")

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

library(ggplot2)
# Create data
data <- data.frame(
type=c("娛樂休閒","知識閱讀","體育競技","科學創新","公益活動") ,
value=c(185,82,36,28,25)
)
# Barplot
ggplot(data, aes(x=type, y=value)) +
geom_bar(stat = "identity", width=0.2, fill="skyblue")

data<- c(185,82,36,28,25)
labels <- c("娛樂休閒","知識閱讀","體育競技","科學創新","公益活動")
pie(data,labels,main ="大學生最喜歡參加的社團之比例", col=heat.colors(length(data)))

library(readxl)
test <- read.csv("E:/table1_1.csv")
print(test)
## 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(test$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(test$Japanese)
## [1] 67.9
median(test$Japanese)
## [1] 62
as.numeric(names(table(test$Japanese)))[which.max(table(test$Japanese))]
## [1] 49
sd(test$Japanese)
## [1] 16.25115
var(test$Japanese)
## [1] 264.1
Q1<- quantile(test$Japanese,1/4)
Q3<- quantile(test$Japanese,3/4)