make_pan_percdrainage_long | R Documentation |
Convert pan_percdrainage column from wide to long format
make_pan_percdrainage_long(df)
df |
a data.table |
The data contained in the 4 "pan_percdrainage" columns created by make_pan_percdrainage_cols
are converted into a long format.
If "pan_percdrainage" is a column in df
, it will be broken into a long format with
caseid
as the ID variable for joining back to the main table. This is because the targeted pancreatectomy
datasets input multiple values into a single "pan_percdrainage" column. For example,
"Yes-other, Yes-bile, Yes-pus" may be an entry in the raw data set. This makes
parsing for patients that had purulent percutaneous drainage at any point, for example, very difficult.
Note that this does not alter the "pan_percdrainage" column.
a data.table
x <- data.table::data.table(caseid = 1:15,
pan_percdrainage = c("Yes-other", "Yes-bile", "Yes-pus", "Yes-amylase-rich fluid",
"Yes-amylase-rich fluid,Yes-pus", "Yes-bile,Yes-other", "Yes-amylase-rich fluid,Yes-pus,Yes-other",
"Yes-amylase-rich fluid,Yes-bile,Yes-other", "Yes-pus,Yes-bile", "Yes-pus,Yes-other",
"Yes-amylase-rich fluid,Yes-pus,Yes-bile", "Yes-amylase-rich fluid,Yes-other",
"Yes-amylase-rich fluid,Yes-pus,Yes-bile,Yes-other", "Yes-amylase-rich fluid,Yes-bile",
"Yes-pus,Yes-bile,Yes-other"))
nsqipr:::make_pan_percdrainage_cols(x)
nsqipr:::make_pan_percdrainage_long(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.