R:如何从 tidycensus 命名 get_acs 中的列?
R: How to name columns in get_acs from tidycensus?
当我运行
age <- get_acs(geography="tract",table="B01001",state="IL")
我收到以下错误:
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.
它还有以下回溯:
─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)
什么是.name_repair
,如何使用它来指定修复?或者有其他方法可以解决这个问题吗?
我已经向 CRAN 发布了新版本的 tidycensus (0.9),它解决了这个问题 - 如果您遇到这个问题,请更新!
当我运行
age <- get_acs(geography="tract",table="B01001",state="IL")
我收到以下错误:
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.
它还有以下回溯:
─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)
什么是.name_repair
,如何使用它来指定修复?或者有其他方法可以解决这个问题吗?
我已经向 CRAN 发布了新版本的 tidycensus (0.9),它解决了这个问题 - 如果您遇到这个问题,请更新!