I have a little question that seems to be so easy in concept, but I cannot find the way to do it...
Say I have a data.frame df2 with a column listing car brands and anot
Playing around, I have found a way to do the trick, even though it may be quite dirty:
df1 <- data.frame(model=as.character(melt(strsplit(df2$models,','))$value), brand=as.character(df2[match(melt(strsplit(df2$models,','))$L1, rownames(df2)),]$brand))
It is not the best solution, since the data.frames actually have many more columns, and I would not want to go one by one... If someone knows a prettier way to solve this, I would appreciate it!