Learn R Programming

readmit (version 0.0.1)

pdc_read: Import datasets from the Provider Data Catalog (PDC)

Description

Explore and import datasets directly from the CMS Provider Data Catalog (PDC).

  • pdc_topics(): Retrieves the list of topics (subcategories) that data is available for

  • pdc_datasets(): Retrieves identifiers, names, descriptions, and other metadata associated with the datasets in the (optionally specified) topics

  • pdc_read(): Imports a full dataset for the given identifier (datasetid). These are found in pdc_datasets().

Usage

pdc_read(datasetid, ...)

pdc_datasets(topics = NULL)

pdc_topics()

Value

A character vector listing available data topics, or a tibble::tibble() containing the requested data/metadata.

Arguments

datasetid

A dataset identifier (e.g., from pdc_datasets())

...

Additional arguments passed to readr::read_csv()

topics

A topic to list dataset metadata for (e.g., from pdc_topics())

Examples

Run this code
# 1. See list of available data topics
pdc_topics()


# 2. See list of datasets available for a topic
hospital_data <- pdc_datasets("Hospitals")
hospital_data

# Find a dataset you want
hospital_data |>
   dplyr::filter(
      stringr::str_detect(
         title,
         pattern = "(?i)readmission"
      )
   )


# 3. Use that data set ID to import
pdc_read("9n3s-kdb3")

Run the code above in your browser using DataLab