we <- c(68,85,74,88,63,78,90,80,58,63)

we2 <- c(85,91,74,100,82,84,78,100,51,70)

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

we <- c(68,85,74,88,63,78,90,80,58,63)
hist(we,
     col= "yellow",
     main ="班上統計成績",
     xlab ="統計",
     ylab ="次數次數")

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

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

# Barplot
ggplot(data, aes(x=name, y=value)) + 
  geom_bar(stat = "identity", width=0.2,  fill="pink") 

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

pie(data,labels,main ="大學生最喜歡參加的社團次數分配表", col=heat.colors(length(data)))

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

# 棒棒糖圖
plot(frequency,
     type = "n",  # 不先畫點
     xaxt = "n",  # 不畫 x 軸
     main = "大學生最喜歡參加的社團類型",
     xlab = "社團類型",
     ylab = "次數",
     ylim = c(0, max(frequency) + 20))

# 畫棒棒糖的線(棒子)
segments(x0 = 1:5, y0 = 0, x1 = 1:5, y1 = frequency, col = "skyblue", lwd = 2)

# 畫棒棒糖的頭(糖果球)
points(1:5, frequency, pch = 16, col = "blue", cex = 2)

# 加上 X 軸標籤
axis(1, at = 1:5, labels = club_type)

data3 <-c (84,63,61,49,89,51,59,53,79,91)
stem(data3)
## 
##   The decimal point is 1 digit(s) to the right of the |
## 
##   4 | 9
##   5 | 139
##   6 | 13
##   7 | 9
##   8 | 49
##   9 | 1
data4 <- c(84,63,61,49,89,51,59,53,79,91)
mean(data4)  
## [1] 67.9
median(data4)
## [1] 62
as.numeric(names(table(data4)))[which.max(table(data4))] 
## [1] 49
sd(data4)
## [1] 16.25115
sd(data4)
## [1] 16.25115
quantile(data4, 1 / 4) 
##  25% 
## 54.5
quantile(data4, 3 / 4) 
##   75% 
## 82.75