I have the following data structure
ID Type Values 1 A 5; 7; 8 2 A 6 3 B 2; 3
and I would like to reshape it to the fol
A data.table approach for coding elegance
data.table
library(data.table) DT <- data.table(dat) DT[, list(Value = unlist(strsplit(as.character(Values), '; '))), by = list(ID, Type)]