I have the following data frame with measurements concatenated into a single column, separated by some delimiter:
df <- data.frame(v1=c(1,2), v2=c(\"a;b;c
You can split the strings with strsplit.
strsplit
Split the strings in the second column:
splitted <- strsplit(as.character(df$v2), ";")
Create a new data frame:
data.frame(v1 = rep.int(df$v1, sapply(splitted, length)), v2 = unlist(splitted))
The result:
v1 v2 1 1 a 2 1 b 3 1 c 4 2 d 5 2 e 6 2 f