make_hep_con_ablation_long: Convert hep_con_ablation_140101 column from wide to long...

View source: R/long.R

make_hep_con_ablation_longR Documentation

Convert hep_con_ablation_140101 column from wide to long format

Description

Convert hep_con_ablation_140101 column from wide to long format

Usage

make_hep_con_ablation_long(df)

Arguments

df

a data.table

Details

The data contained in the 5 "hep_con_ablation" columns created by make_hep_con_ablation_cols are converted into a long format.

If "hep_con_ablation_140101" 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 hepatectomy datasets input multiple values into a single "hep_con_ablation_140101" column. For example, "Microwave ablation,Other ablation" may be an entry in the raw data set. This makes parsing for patients that had other types of concurrent ablation at any point, for example, very difficult.

Note that this does not alter the "hep_con_ablation_140101" column.

Value

a data.table

Examples

x <- data.table::data.table(caseid = 1:12,
hep_con_ablation_140101 = c("Microwave ablation", "RFA ablation", "Other ablation",
"Microwave ablation,Other ablation", "RFA ablation,Microwave ablation",
"RFA ablation,Other ablation", "RFA ablation,Alcohol ablation", "Alcohol ablation",
"Microwave ablation,Alcohol ablation", "Cryoablation", NA, "RFA ablation,Cryoablation"))

nsqipr:::make_hep_con_ablation_cols(x)
nsqipr:::make_hep_con_ablation_long(x)


dylanrussellmd/nsqipr documentation built on Oct. 13, 2023, 11:01 a.m.