Skip to contents

Look up rows of the data.cdc.gov dataset table corresponding to the entries of a given vector.

Usage

data_cdc_gov_dataset_lookup(dataset, format, strict = FALSE)

Arguments

dataset

vector of dataset keys or ids

format

format in which the input dataset vector is coded. One of "key" or "id".

strict

Error if not all keys/ids can be matched? Default FALSE.

Value

A tibble with the corresponding rows of the data_cdc_gov_dataset_table matching the location vector (with repeats possible). Returns NA rows where matches cannot be found.

Examples


data_cdc_gov_dataset_lookup(
  c("nhsn_hrd_prelim", "nhsn_hrd_final"),
  "key")
#> # A tibble: 2 × 4
#>   key             id        date_column    location_column
#>   <chr>           <chr>     <chr>          <chr>          
#> 1 nhsn_hrd_prelim mpgq-jmmr weekendingdate jurisdiction   
#> 2 nhsn_hrd_final  ua7e-t2fy weekendingdate jurisdiction   

data_cdc_gov_dataset_lookup(
  c("rdmq-nq56", "ua7e-t2fy", "ua7e-t2fy"),
  "id")
#> # A tibble: 3 × 4
#>   key                 id        date_column    location_column
#>   <chr>               <chr>     <chr>          <chr>          
#> 1 nssp_prop_ed_visits rdmq-nq56 week_end       county         
#> 2 nhsn_hrd_final      ua7e-t2fy weekendingdate jurisdiction   
#> 3 nhsn_hrd_final      ua7e-t2fy weekendingdate jurisdiction   

data_cdc_gov_dataset_lookup(
  c("rdmq-nq56", "unavailable", "ua7e-t2fy"),
  "id")
#> # A tibble: 3 × 4
#>   key                 id        date_column    location_column
#>   <chr>               <chr>     <chr>          <chr>          
#> 1 nssp_prop_ed_visits rdmq-nq56 week_end       county         
#> 2 NA                  NA        NA             NA             
#> 3 nhsn_hrd_final      ua7e-t2fy weekendingdate jurisdiction