mnpopcenter / ipumsr

Read IPUMS data into R.
http://tech.popdata.org/ipumsr
Mozilla Public License 2.0
89 stars 8 forks source link

`vars` argument doesn't work for csv extracts #26

Closed gergness closed 6 years ago

gergness commented 6 years ago

Continuing from http://answers.popdata.org/How-I-read-select-columns-IPUMs-data-ipumsr-q2428716.aspx?tc=e99fa200-f868-448f-a338-093a7ab69e11

library(ipumsr)

read_ipums_micro(
  ipums_example("cps_00006.xml"), 
  data_file = ipums_example("cps_00006.csv.gz"), 
  vars = c(YEAR, SERIAL)
)
#> Use of data from IPUMS-CPS is subject to conditions including that users should
#> cite the data appropriately. Use command `ipums_conditions()` for more details.
#> # A tibble: 7,668 x 8
#>     YEAR SERIAL HWTSUPP STATEFIP MONTH PERNUM WTSUPP   INCTOT
#>    <dbl>  <dbl>   <dbl>    <int> <int>  <int>  <dbl>    <int>
#>  1 1962.    80.   1476.       55     3      1  1476.     4883
#>  2 1962.    80.   1476.       55     3      2  1471.     5800
#>  3 1962.    80.   1476.       55     3      3  1579. 99999998
#>  4 1962.    82.   1598.       27     3      1  1598.    14015
#>  5 1962.    83.   1707.       27     3      1  1707.    16552
#>  6 1962.    84.   1790.       27     3      1  1790.     6375
#>  7 1962.   107.   4355.       19     3      1  4355. 99999999
#>  8 1962.   107.   4355.       19     3      2  1386.        0
#>  9 1962.   107.   4355.       19     3      3  1629.      600
#> 10 1962.   107.   4355.       19     3      4  1432. 99999999
#> # ... with 7,658 more rows

Created on 2018-04-04 by the reprex package (v0.1.1.9000).

gergness commented 6 years ago

Also from that screenshot, I don't think value label attributes are included.