View source: R/chars_functions.R
chars_icd_ccs_count | R Documentation |
Generate hospitalization counts from WA State Comprehensive Hospital
Abstract Reporting System (CHARS) data using partial strings from the ICD-10-CM
or ICD-9-CM descriptions or AHRQ HCUP's CCSR based 'broad' and 'detailed'
classifications. Needs line-level CHARS data with a properly formatted
ICD-CM column (e.g., the data available from get_data_chars()
).
See chars_icd_ccs()
for a complete list of available ICD-10-CM,
ICD-9-CM, and superlevel, broad, midlevel, and narrow classifications.
¡¡¡REMEMBER!!! ICD-10-CM started in 2016! Be sure to use the correct
icdcm_version
.
chars_icd_ccs_count(
ph.data = NULL,
icdcm_version = 10,
CMtable = NULL,
icdcm = NULL,
superlevel = NULL,
broad = NULL,
midlevel = NULL,
detailed = NULL,
icdcol = "diag1",
group_by = NULL,
kingco = T,
mykey = "hhsaw"
)
ph.data |
a data.table or data.frame. Must contain CHARS data structured with one person per row and with at least one column of ICD CM codes. NOTE! ph.data must have a column named The default is |
icdcm_version |
an integer vector of length one specifying the ICD CM
version that you want to reference. Acceptable options include: The default is |
CMtable |
An optional data.table containing the reference table of ICD codes
and their classifications. This should come from The default is |
icdcm |
a character vector of length 1. An ICD CM description OR code.
It is case agnostic and works with partial strings. For example, both
'rotavira' & 'A080' would provide the results for 'Rotaviral enteritis' for
ICD-10-CM. You can also combine multiple search terms. For example,
'rotavira|choler' would count all Rotaviral enteritis AND cholera
hospitalizations. View available options with
The default is |
superlevel |
a character vector of length 1. Case agnostic and works
with partial strings. View available options with
The default is |
broad |
a character vector of length 1. Case agnostic and works with
partial strings. View available options with
The default is |
midlevel |
a character vector of length 1. Case agnostic and works with
partial strings. View available options with
The default is |
detailed |
a character vector of length 1. Case agnostic and works with
partial strings. View available options with
The default is |
icdcol |
a character vector of length one that specifies the name of the column in ph.data that contains the ICD10-cm codes of interest. The default is |
group_by |
a character vector of indeterminate length. This is used to
specify all the variables by which you want to group (a.k.a. stratify) the
results. For example, if you specified The default is |
kingco |
a logical vector of length one. It specifies whether you want to limit the analysis to King County. NOTE this only works with data imported
with the The default is |
mykey |
Character vector of length 1. Identifies the keyring:: service that can be used to access the Health & Human Services Analytic Workspace (HHSAW). The default is |
This function needs the user to enter a search string in one or more of the
following arguments in order to search the CHARS data for the corresponding
ICD CM codes: icdcm
, superlevel
, broad
, midlevel
,
or detailed
.
Partial search terms are acceptable and they are case-insensitive. For
example, if you set broad = 'ex'
with icdcm_version = 10
, the
function would return counts for "Diseases of the eye and adnEXa" as well as
"EXternal causes of morbidity". It also understands simple regex syntax,
including ^
, $
, and |
.
Note: If you submit values for more than one of icdcm
,
superlevel
, broad
, midlevel
, or detailed
they must
be nested. For example, broad = 'neoplasms', detailed = 'sarcoma'
will
give results because sarcomas are type of cancers. However,
broad = 'neoplasms', detailed = 'intestinal infection'
will return an
error because your resulting table will have zero rows.
Generates a table with columns for each of the search terms you entered (e.g.,
icdcm
, broad
, and/or detailed
) as well as
any group_by
variables and a column named hospitalizations
that
contains the relevant counts.
# example #1: 2019 King County hospitalizations for chemotherapy, by sex
blah = get_data_chars(year = 2019, kingco = TRUE)
myresult <- chars_icd_ccs_count(ph.data = blah,
detailed = 'headache',
group_by = c('chi_sex'))
print(myresult)
# example #2: 2022 King County hospitalizations for asthma using
# an external reference table
myrefTable <- chars_icd_ccs()
mydata = get_data_chars(year = 2022, kingco = TRUE)
myresult <- chars_icd_ccs_count(ph.data = mydata,
CMtable = myrefTable,
detailed = 'asthma',
group_by = c('chi_sex'))
print(myresult)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.