knitr::opts_chunk$set( collapse = TRUE , comment = "#>" ) options(knitr.kable.NA = "")
library("aafractions.ncc") library("dplyr")
Describe data items in this package
Describe how this package can be used in Alcohol Attributable Fractions calculations
Describe various Alcohol Attributable Fraction analyses
Underlying the Alcohol Attributable Fractions calculations are the lookup tables relating alcohol conditions to ICD10 diagnosis codes and those conditions to their respective (age, sex) specific attributable fractions.
There have been a number of revisions to initial lookup tables. This package provides a number of recent lookup tables in a machine readable and processable format for use in local alcohol attributable fraction calculations.
The original lookup tables are available in a number of formats including .pdf documents and .xlsx spreadsheets. Their extraction is (to be) described in another document.
This document shows how theses tables are to be accessed and queried.
Load package with:
library("aafractions.ncc")
Three datasets are now available.
aa_conditions
, aa_versions
and aa_fractions
.
aa_conditions
is a data.frame object that lists all the alcohol attributable conditions that are present in the lookup tables.
glimpse(aa_conditions)
For each condition there is a unique identifier, condition_uid
, by which that condition is referenced. Each condition has textual description (the desc
field) and a definition in terms of ICD10 diagnosis codes (the codes
field). This allows a condition to be derived from an ICD10 code.
There are in addition two levels of further categorisation to indicate the nature of the condition which is of use in later analysis. cat1
indicates wholly attributable, or partially attributable - chronic or partially attributable - acute. cat2
indicates wholly attributable or one of eleven other conditions.
require("dplyr", warn.conflicts = FALSE) set.seed(20180219) ; invisible(sample(32)) knitr::kable( caption = "aa_conditions (pseudo-random rows)" , sample_n(aa_conditions, 4) )
aa_fractions
is a data.frame object that lists all the alcohol attributable fractions for each of the alcohol attributable conditions.
glimpse(aa_fractions)
list("aa_ageband", "sex", "analysis_type", "version") %>% lapply(function(x, y){unique(select(y, x))}, y = aa_fractions) %>% knitr::kable(row.names = FALSE)
aa_versions
is a data.frame object that summarises which conditions are used in each version of the lookup tables.
#knitr::kable(data.table::dcast(aa_versions, ... ~ version, value.var = "condition_fuid", fun = function(x){any(as.logical(x))})) knitr::kable( caption = "aa_versions (pseudo-random rows)" , sample_n(aa_versions, 6) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.