age <- c(50,55,63,55,67,43,52)
high <- c(150,160,170,175,150,153,165)
mean(age)
## [1] 55
median(age)
## [1] 55
mode(age)
## [1] "numeric"
Q1 <- quantile(age, 1 / 4)
Q2 <- quantile(age, 2 / 4)
Q3 <- quantile(age, 3 / 4)
Q1
## 25%
## 51
Q2
## 50%
## 55
plot(age,high)

plot(age,high,
pch=16,
col="#9AE0D8",
xlab="年齡",
ylab="身高",
main="班級的年齡體重")

hist(age,
col= "lightyellow",
main ="班上的年齡與身高",
xlab ="體重",
ylab ="人數")

# Load ggplot2
library(ggplot2)
# Create data
data <- data.frame(
遊戲=c("原神","崩壞:星穹鐵道決區","絕區零"),
運營年數=c(4,2,0.5)
)
# Barplot
ggplot(data, aes(x=遊戲, y=運營年數)) +
geom_bar(stat = "identity")

data2<- c(50,23,35,48)
labels <- c("英文系","法文系","德文","翻譯")
pie(data2,labels,main ="學生的比例", col=heat.colors(length(data)))
