Description Usage Arguments Functions Long and Wide Formats Data structure Conversion See Also Examples
These functions take your patient data, and allow you to describe whether it
is wide or long. icd
never requires you do this, but it may help avoid
errors, especially if you have atypical data that might confuse icd
's
heuristics.
1 2 3 4 5 6 7 | as.icd_long_data(x, warn = TRUE)
as.icd_wide_data(x, warn = TRUE)
icd_long_data(..., warn = TRUE)
icd_wide_data(x, ..., warn = TRUE)
|
x |
Input data is a |
warn |
Single logical, if |
... |
Data used to construct data frame before setting the appropriate class. |
as.icd_long_data
: Set class on a matrix or data.frame to
icd_long_data
. To convert wide to long data, use
wide_to_long
.
as.icd_wide_data
: Construct a data.frame
, adding the
icd_long_data
class.
icd_long_data
: Construct a data.frame
, adding the
icd_long_data
class.
icd_wide_data
: Construct a data.frame
, adding the
icd_wide_data
class.
As is common with many data sets, key variables can be concentrated in one column or spread over several. Tools format of clinical and administrative hospital data, we can perform the conversion efficiently and accurately, while keeping some metadata about the codes intact, e.g. whether they are ICD-9 or ICD-10.
Long or wide format ICD data are all expected to be
in a data frame. The data.frame
itself does not carry any ICD
classes at the top level, even if it only contains one type of code;
whereas its constituent columns may have a class specified, e.g.
icd9
or icd10who
.
To convert between long and wide data, use
long_to_wide
or wide_to_long
. Conversion
functions in other packages, such as ddplyr
will work, too, but will
need some work to account for the typical structure of patient data and
diagnostic codes. This is not done with ddplyr
, data.table
etc because it would add a big dependency burden. This package aims to be
agnostic and use base R as much as possible.
Other ICD data types:
as.comorbidity_map()
,
set_icd_class
Other ICD data types:
as.comorbidity_map()
,
set_icd_class
Other ICD data types:
as.comorbidity_map()
,
set_icd_class
1 2 3 4 5 6 7 8 | (w <- icd_wide_data(
id = c(1, 2, 3),
dx01 = c("100", "441", "V20"),
dx02 = c("E9981", "V10", "44004")
))
wide_to_long(w)
class(uranium_pathology)
class(vermont_dx)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.