makeVarlist: Use variable metadata to find variables containing a given...

Description Usage Arguments Examples

View source: R/makevar_functions.R

Description

Return a list of variable names or data frame of variable metadata containing a given string. This can be used create a list of variables to later pass to getCensus, or a data frame documenting variables used in a given project.

Usage

1
2
makeVarlist(name, vintage = NULL, find, varsearch = "all",
  output = "list")

Arguments

name

API name - e.g. acs5. See list at https://api.census.gov/data.html

vintage

Year of dataset, e.g. 2014 - not required for timeseries APIs

find

A string to find in the variable metadata

varsearch

Optional argument specifying which fields to search. Default is "all". Options are "all", "name", "label", or "concept".

output

Optional argument, specifying output to "list" or "dataframe". Default is "list".

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Return a list, and then use getCensus function to retrieve those variables
myvars <- makeVarlist(name = "timeseries/poverty/saipe",
  find = "Ages 0-4",
  varsearch = "label")
myvars
saipe_dt <- getCensus(name = "timeseries/poverty/saipe",
  time = 2016,
  vars = myvars,
  region = "state:*")
head(saipe_dt)

censusapi documentation built on May 2, 2019, 9:39 a.m.