Working with the `socialrisk` Package

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(socialrisk)

Introduction

The goal of socialrisk is to create an efficient way to identify social risk from administrative health care data using ICD-10 diagnosis codes.

Load Sample Data

We've created a sample dataset of ICD-10 administrative data which we can load in.

i10_wide

Preparing the Data

We use the built-in clean_data() function to specify the: dataset, patient id, current data format (wide or long), and the prefix of the diagnoses variables.

data <- clean_data(dat = i10_wide,
                   id = patient_id,
                   style = "wide",
                   prefix_dx = "dx")
head(data, 10)

Social Risk

Now, we can run our various social risk functions, with varying taxonomies.

Centers for Medicare and Medicaid Services (CMS)

cms <- socialrisk(dat = data, id = patient_id, dx = dx, taxonomy = "cms")
head(cms, 5)

Missouri Hospital Association

mha <- socialrisk(dat = data, id = patient_id, dx = dx, taxonomy = "mha")
head(mha, 5)

SIREN - UCSF

siren <- socialrisk(dat = data, id = patient_id, dx = dx, taxonomy = "siren")
head(siren, 5)


Try the socialrisk package in your browser

Any scripts or data that you put into this service are public.

socialrisk documentation built on Feb. 16, 2023, 8:03 p.m.