Di bagian ini, kita akan membuat data frame yang berisi informasi
socio-demografis dari 10 negara bagian di AS.
data <- data.frame(
State = c("State1", "State2", "State3", "State4", "State5", "State6", "State7", "State8", "State9", "State10"),
Population = c(3615, 21198, 2861, 2341, 812, 10735, 2284, 11860, 681, 472),
Income = c(3624, 5114, 4628, 3098, 4281, 4561, 4660, 4449, 4167, 3907),
Illiteracy = c(2.1, 1.1, 0.5, 2.4, 0.7, 0.8, 0.6, 1.0, 0.5, 0.6),
Life.Expectancy = c(69.05, 71.71, 72.56, 68.09, 71.23, 70.82, 72.13, 70.43, 72.08, 71.64),
Homicide = c(15.1, 10.3, 2.3, 12.5, 3.3, 7.4, 4.2, 6.1, 1.7, 5.5),
Graduates = c(41.3, 62.6, 59.0, 41.0, 57.6, 53.2, 60.0, 50.2, 52.3, 57.1),
Freezing = c(20, 20, 140, 50, 174, 124, 44, 126, 172, 168)
)
print(data)
## State Population Income Illiteracy Life.Expectancy Homicide Graduates
## 1 State1 3615 3624 2.1 69.05 15.1 41.3
## 2 State2 21198 5114 1.1 71.71 10.3 62.6
## 3 State3 2861 4628 0.5 72.56 2.3 59.0
## 4 State4 2341 3098 2.4 68.09 12.5 41.0
## 5 State5 812 4281 0.7 71.23 3.3 57.6
## 6 State6 10735 4561 0.8 70.82 7.4 53.2
## 7 State7 2284 4660 0.6 72.13 4.2 60.0
## 8 State8 11860 4449 1.0 70.43 6.1 50.2
## 9 State9 681 4167 0.5 72.08 1.7 52.3
## 10 State10 472 3907 0.6 71.64 5.5 57.1
## Freezing
## 1 20
## 2 20
## 3 140
## 4 50
## 5 174
## 6 124
## 7 44
## 8 126
## 9 172
## 10 168