0

i did like this

st <- data.frame(state.x77)

st[, "Illiteracy"]

i want print state name(rowname) and illiteracy
but my code print just illiteracy value...

this is result

> st[,"Illiteracy"]
 [1] 2.1 1.5 1.8 1.9 1.1 0.7 1.1 0.9 1.3 2.0 1.9 0.6 0.9 0.7 0.5 0.6 1.6 2.8 0.7 0.9
[21] 1.1 0.9 0.6 2.4 0.8 0.6 0.6 0.5 0.7 1.1 2.2 1.4 1.8 0.8 0.8 1.1 0.6 1.0 1.3 2.3
[41] 0.5 1.7 2.2 0.6 0.6 1.4 0.6 1.4 0.7 0.6

i want this result

             Illiteracy 
Iowa                0.5    
Nevada              0.5  
South Dakota        0.5    
Idaho               0.6    
Kansas              0.6    
Minnesota           0.6    
Montana             0.6    
Nebraska            0.6   
Oregon              0.6  
Utah                0.6  
Hyojuice
  • 1
  • 2

0 Answers0