age <- c(1,6,32,55,67,77,100)

height <- c(156,141,164,187,173,140,102)

mean(age) 
## [1] 48.28571
mean(height)
## [1] 151.8571
Q1 <- quantile(height, 1/4)
Q2 <- quantile(height, 2/4)

median(height)
## [1] 156
Q1
##   25% 
## 140.5
Q2
## 50% 
## 156
plot(age, height)

plot(age,height,
     pch = 17,
     col= "skyblue",
     main ="age height",
     xlab ="age",
     ylab ="height")

hist(age,
     col= "lightyellow",
     main ="age height",
     xlab ="體重",
     ylab ="次數")

# Load ggplot2
library(ggplot2)
library(hrbrthemes) # for style

# make data
data <- data.frame(
  group=c("A ","B ","C ","D ") , 
  value=c(33,62,56,67) , 
  number_of_obs=c(100,500,459,342)
)
 
# Calculate the future positions on the x axis of each bar (left border, central position, right border)
data$right <- cumsum(data$number_of_obs) + 30*c(0:(nrow(data)-1))
data$left <- data$right - data$number_of_obs 
 
# Plot
ggplot(data, aes(ymin = 0)) + 
    geom_rect(aes(xmin = left, xmax = right, ymax = value, colour = group, fill = group)) +
    xlab("number of obs") + 
    ylab("value") +
    theme_ipsum() +
    theme(legend.position="none") 
## Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): Windows
## 字型資料庫裡不明的字型系列
## Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): Windows
## 字型資料庫裡不明的字型系列
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## Windows 字型資料庫裡不明的字型系列
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## Windows 字型資料庫裡不明的字型系列
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## Windows 字型資料庫裡不明的字型系列

data<- c(50,23,35,48)
labels <- c("英文系","法文系","德文","翻譯")

pie(data,labels,main ="學生的比例", col=heat.colors(length(data)))