User Tools

Site Tools


r:extracting_variable_names_and_lables

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
r:extracting_variable_names_and_lables [2017/11/23 17:13] hkimscilr:extracting_variable_names_and_lables [2017/11/23 17:42] (current) hkimscil
Line 1: Line 1:
-{{:r:states.csv}} +{{:r:states.rds}} 
-<code>data.info <- data.frame(attributes(data)[c("names", "var.labels")]) +<code
-data.info+z <- gzcon(url("http://commres.net/wiki/_media/r/states.rds")) 
 +data <- read.RDS(z) 
 +head(data, 8) 
 +> head(data,8) 
 +  X       state  region      pop   area density metro waste energy miles toxic green house 
 +1 1     Alabama   South  4041000  52423   77.08  67.4  1.11    393  10.5 27.86 29.25    30 
 +2 2      Alaska    West   550000 570374    0.96  41.1  0.91    991   7.2 37.41    NA     0 
 +3 3     Arizona    West  3665000 113642   32.25  79.0  0.79    258   9.7 19.65 18.37    13 
 +4 4    Arkansas   South  2351000  52075   45.15  40.1  0.85    330   8.9 24.60 26.04    25 
 +5 5  California    West 29760000 155973  190.80  95.7  1.51    246   8.7  3.26 15.65    50 
 +6 6    Colorado    West  3294000 103730   31.76  81.5  0.73    273   8.3  2.25 21.89    36 
 +7 7 Connecticut N. East  3287000   4845  678.43  92.4  0.88    234   8.0  6.49 14.63    64 
 +8 8    Delaware   South   666000   1955  340.66  66.3  1.13    349   9.8  9.88 21.53    69 
 +  senate csat vsat msat percent expense income high college 
 +1     10  991  476  515          3627 27.498 66.9    15.7 
 +2     20  920  439  481      41    8330 48.254 86.6    23.0 
 +3     33  932  442  490      26    4309 32.093 78.7    20.3 
 +4     37 1005  482  523          3700 24.643 66.3    13.3 
 +5     47  897  415  482      47    4491 41.716 76.2    23.4 
 +6     58  959  453  506      29    5064 35.123 84.4    27.0 
 +7     87  897  429  468      81    7602 48.618 79.2    27.2 
 +8     83  892  428  464      61    5865 40.641 77.5    21.4 
 + 
 +</code> 
 + 
 +<code> 
 +> data.info <- data.frame(attributes(data)[c("names", "var.labels")]) 
 +data.info 
 +     names                      var.labels 
 +1    state                           State 
 +2   region             Geographical region 
 +3      pop                 1990 population 
 +4     area         Land area, square miles 
 +5  density          People per square mile 
 +6    metro Metropolitan area population, % 
 +7    waste    Per capita solid waste, tons 
 +8   energy Per capita energy consumed, Btu 
 +9    miles    Per capita miles/year, 1,000 
 +10   toxic Per capita toxics released, lbs 
 +11   green Per capita greenhouse gas, tons 
 +12   house    House '91 environ. voting, % 
 +13  senate   Senate '91 environ. voting, % 
 +14    csat        Mean composite SAT score 
 +15    vsat           Mean verbal SAT score 
 +16    msat             Mean math SAT score 
 +17 percent       % HS graduates taking SAT 
 +18 expense Per pupil expenditures prim&sec 
 +19  income Median household income, $1,000 
 +20    high             % adults HS diploma 
 +21 college         % adults college degree
  
 </code> </code>
r/extracting_variable_names_and_lables.1511426614.txt.gz · Last modified: 2017/11/23 17:13 by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki