#練習1 練習
age <- c(28,45,31,36,54,28)
weight <- c(51,69,73,47,51,63)
mean(age) #平均數
## [1] 37
median(age) #中位數
## [1] 33.5
as.numeric(names(table(age)))[which.max(table(age))] #眾數
## [1] 28
sd(age) #標準差 平方 變異數
## [1] 10.50714
var(age) #變異數 根號 標準差
## [1] 110.4
min(age)
## [1] 28
max(age)
## [1] 54
plot(age,weight, pch = 18, col= "violet", main ="看診病人的年齡體重", xlab ="年齡", ylab ="體重")
stem(age)
##
## The decimal point is 1 digit(s) to the right of the |
##
## 2 | 88
## 3 | 16
## 4 | 5
## 5 | 4
hist(weight, col= "violet", main ="看診病人的年齡體重", xlab ="體重", ylab ="年齡")