Learn R Programming

icd (version 3.3)

as.icd_long_data: Convert between and identify 'long' and 'wide' patient data formats

Description

Long and Wide Formats: 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.

icd_long_data and icd_wide_data create data.frames using all the arguments, and sets the class, whereas as.icd_long_data and as.icd_wide_data just set the class of an existing data.frame.

Usage

as.icd_long_data(x)

as.icd_wide_data(x)

icd_long_data(...)

icd_wide_data(...)

is.icd_long_data(x)

is.icd_wide_data(x)

Arguments

x

data.frame or matrix to set class, or convert.

...

arguments passed on to create a data.frame

Functions

  • 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: Set class on a matrix or data.frame to icd_wide_data. To convert long to wide data, use long_to_wide.

  • 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.

  • is.icd_long_data: Return TRUE if x has the icd_long_data class.

  • is.icd_wide_data: Return TRUE if x has the icd_wide_data class.

Details

Long or wide format ICD data is expected to be in a data frame. It does not carry any ICD classes at the top level, even if it only contains one type of code, but its constituent columns may have a class specified, e.g. 'icd9'.

See Also

Other ICD code conversion: convert, long_to_wide, wide_to_long

Other ICD code conversion: convert, long_to_wide, wide_to_long