Skip to content
This repository has been archived by the owner on Aug 23, 2022. It is now read-only.
Steve Harris edited this page Dec 1, 2016 · 4 revisions

Contents

  1. Installing ccdata
  2. Using ccdata
  3. Additional functions in ccfun

This repository contains utilities for working with data. There are a mixture of 'helper' functions that relabel variables for you, or search for fields based on their metadata. And there are 'clinical' functions that derive secondary variables such as severity of illness scores (SOFA) etc.

Helper functions

  • which_NHIC: Extract NHIC codes based on the value of a key:value pair in list
  • find_NHIC: Look for possible matches in NHIC dict
  • relabel_cols: Relabels a wide data2d data.table using the shortName field in the dictionary
  • parse_ICNARC: Parses ICNARC diagnostic codes (Split text codes by level and then label as per ICNARC codes)

Clinical Utilities

  • clean_gcs: Cleans GCS by replacing with NA where concurrently sedated
  • gen_sofa_c: Generates the SOFA CVS score; requires MAP and norad and optionally handles other vasopressors
  • gen_sofa_r: Generates the SOFA Respiratory score; requires PF ratio and optionally an indicator for postive pressure ventilation
  • gen_sofa_k:
  • gen_sofa_h:
  • gen_sofa_n:
  • gen_sofa_l:

Installation

You will need devtools, and then simply

install_github("cc-hic/ccfun")
library(ccfun)

Help is available for most functions

R> ?ccfun::relabel_cols
relabel_cols               package:ccfun               R Documentation

Relabels a wide data2d data.table

Description:

     Relabels the columns of a wide data2d data.table (as generated by
     the selectTable function in ccdata). Because this uses the
     data.table::setnames function then the name changes happen 'in
     place' and nothing is returned

Usage:

     relabel_cols(dt, label.in, label.out, dict = NULL)

Arguments:

      dt: data.table to be relabelled

label.in: name for the item to be translated

label.out: name of the item to be used for the new column name

    dict: defaults to ITEM_REF

Value:

     0 (if the function completes)

Examples:

     # use the ITEM_REF dictionary (not run)
     # relabel_cols(tdt, "dataItem", "shortName")
     # use a custom dictionary (not run)
     # relabel_cols(tdt, "dataItem", "shortName", dict=analysis.dict)

Previous