rtibbletidycensus

R: How to name columns in get_acs from tidycensus?


When I run

age <- get_acs(geography="tract",table="B01001",state="IL")

I get the following error:

Getting data from the 2012-2016 5-year ACS
Loading ACS5 variables for 2016 from table B01001. To cache this dataset for faster access to ACS tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per ACS dataset.
Using FIPS code '17' for state 'IL'
Error: Columns 1, 2, 3, 4, 5, … (and 47 more) must be named.
Use .name_repair to specify repair.

It also has the following backtrace:

 ─tidycensus::get_acs(...)
 ─purrr::map(...)
 ─tidycensus:::.f(.x[[i]], ...)
 ─tidycensus:::load_data_acs(...)
 ─dplyr::tbl_df(fromJSON(content))
 ─tibble:::as_tibble.matrix(data, .name_repair = "check_unique")
 ─tibble:::as_tibble.data.frame(m, ..., .name_repair = .name_repair)
 ─tibble:::as_tibble.list(unclass(x), ..., .rows = .rows, .name_repair = .name_repair)
 ─tibble:::lst_to_tibble(x, .rows, .name_repair, col_lengths(x))
 ─tibble:::set_repaired_names(x, .name_repair)
 ─tibble:::repaired_names(names(x), .name_repair = .name_repair)
 ─tibble:::check_unique(new_name)

What is .name_repair, and how do I use it to specify repair? or is there some other way to get around this?


Solution

  • I've published a new version of tidycensus (0.9) to CRAN which resolves this - please update if you come across this issue!