tmp <- data.frame(
statistic=c(68,85,74,88,63,78,90,80,58,63),
math=c(85,91,74,100,82,84,78,100,51,70))

# library
library(ggplot2)
 
# tmp dataset is natively provided by R
#head(tmp)
 
# use options!
ggplot(tmp, aes(x=statistic, y=math)) + 
    geom_point(
        color="orange",
        fill="#69b3a2",
        shape=21,
        alpha=0.5,
        size=6,
        stroke = 2
        )

ggplot(tmp, aes(x=math )) +
  geom_bar(color="blue", fill=rgb(0.1,0.4,0.5,0.7) )

hist(tmp$math,
     col= "lightyellow",
     main ="數學成績",
     xlab ="成績",
     ylab ="數學")

data <- data.frame(
  社團類型=c("娛樂休閒","知識閱讀","體育競技","科技創新","公益活動") ,  
  次數=c(185,82,36,28,25)
  )
ggplot(data, aes(x=社團類型, y=次數)) + 
  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)))

data2 <- data.frame(
  x=c("娛樂休閒","知識閱讀","體育競技","科學創新","公益活動"),
  y=c(185,82,36,28,25))
ggplot(data2, aes(x=x, y=y)) +
  geom_segment( aes(x=x, xend=x, y=0, yend=y)) +
  geom_point( size=5, color="red", fill=alpha("orange", 0.3), alpha=0.7, shape=21, stroke=2) 

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
var(data4)
## [1] 264.1
quantile(data4, 1 / 4) 
##  25% 
## 54.5
quantile(data4, 3 / 4) 
##   75% 
## 82.75