birthwt$race <- c("White", "Black", "Other")[birthwt$race]##取得birthwt資料框中race的欄位
aggregate(bwt ~ race, length, data = dat)## race bwt
## 1 1 96
## 2 2 26
## 3 3 67
race 1=White 2=Black 3=Other
birthwt$race <- c("White", "Black", "Other")[birthwt$race]##取得birthwt資料框中race的欄位
aggregate(bwt ~ race, length, data = dat)## race bwt
## 1 1 96
## 2 2 26
## 3 3 67
race 1=White 2=Black 3=Other