-
Notifications
You must be signed in to change notification settings - Fork 32
Description
Several years ago, when there were FAR less Census Bureau API endpoints, I added some optional parameters to getCensus() that were convenience options for some of the economic data endpoints. The package supported the use arbitrary parameters (predicates, in Census-speak) since v0.6.0, released on CRAN in 2019, so this is both unnecessary and unwieldy. Also, catering specifically to certain endpoints in this function is not in scope of the package.
The named parameters are:
c("year", "date", "period", "monthly", "category_code", "data_type_code", "naics", "pscode", "naics2012", "naics2007", "naics2002", "naics1997", "sic")
year was added to the list in v0.7.2 when some of the endpoints were swinging back and forth between using time versus year. They are now more consistent and many of the timeseries APIs use lowercase time as a required predicate. YEAR is a variable name in hundreds of the non-timeseries APIs.
The vast majority of this list are actually UPPERCASE predicates in the APIs, not lowercase.
Users will still be able to use the full functionality of the APIs with arbitrary parameters without having these as named optional parameters.
For example, use uppercase YEAR here instead of lowercase year. But really, the preferred syntax now is time, which is the endpoint's true predicate for filtering the timeseries.
# old
saipe_schools <- getCensus(
name = "timeseries/poverty/saipe/schdist",
vars = c("SD_NAME", "SAEPOV5_17V_PT", "SAEPOVRAT5_17RV_PT"),
region = "school district (unified):*",
regionin = "state:25",
year = 2022)
# new and valid but not preferred
saipe_schools <- getCensus(
name = "timeseries/poverty/saipe/schdist",
vars = c("SD_NAME", "SAEPOV5_17V_PT", "SAEPOVRAT5_17RV_PT"),
region = "school district (unified):*",
regionin = "state:25",
YEAR = 2022)
# preferred
saipe_schools <- getCensus(
name = "timeseries/poverty/saipe/schdist",
vars = c("SD_NAME", "SAEPOV5_17V_PT", "SAEPOVRAT5_17RV_PT"),
region = "school district (unified):*",
regionin = "state:25",
time = 2022)