0

我正在尝试加载人口普查数据,但每次使用get_decennial我的代码都会引发错误。

library(ggplot2)
library(tidyverse)
library(tidycensus)

vars <- c(tot_hh = "H001001",
         tot_rural_hh = "H002005",
         tot_rent_hh = "H004004",
         avg_hh_size = "H012001",
         tot_pop = "P003001",
         nh_white_pop = "P005003",
         nh_black_pop = "P005004",
         nh_asian_pop = "P005006",
         hispanic_pop = "P005010",
         med_age = "P013001")

SD_tracts <- get_decennial(geography = "tract", variables = vars,
                           state = "CA", county = "San Diego",
                           output = "wide")

我已经定义了几个变量,我试图调用这个数据,但每次我都会收到这个错误消息:

Error in UseMethod("select_") : no applicable method for 'select_' applied to an object of class "character".

我究竟做错了什么?

谢谢

4

0 回答 0