Long table to width table, for patients' drug list and diagnosis table
Source:R/wider_clean.R
wider_clean.Rd
Usually each line of the patient's drug list is a separate drug name, while each row of the patient's diagnosis table is a combined string of multiple diagnoses. Therefore, it is necessary to develop a stream form to carry out efficient length-width conversion based on the patient's visit ID, so as to facilitate the descriptive statistics of the downstream process.
Arguments
- data
a dataframe
- aim_select
three column names for analysis, including patient ID, visiting ID, and column names that need to change from length to width, the user is required to give the column name in the specified order.
- ifunion
used to indicate whether the column that needs to be long to wide is a merged string. See more for details
- split
default is ",".When the
ifunion = TRUE
,split
provides a split point for data deduplication.
Value
A unique value for each patient, such as whether each patient has suffered from a disease or used a drug.
Details
ifunion
parameter provides the user with an indication of whether the column
used for length-width conversion is in the form of a merged string. When this
colunm is a merged string (usually diagnosis table), it needs to be deduplicated
based on the group ID expansion data and separate a collapsed column into
multiple rows,see separate_rows()
.