. .
DF <- data.frame(ID=1:3,
Type=c('A','A','B'),
Values=c(' 5; 7; 8', '6', ' 2;3'))
colsplit() "reshape2". , , .
require(reshape2)
DF2 <- data.frame(DF[-3], colsplit(DF$Values, ";", c("V.1", "V.2", "V.3")))
na.omit(melt(DF2, id.vars=c("ID", "Type")))
Here you can sort and drop columns to get the final desired result.
source
share