I have a dataset where the data is structured this way
dt<- data.table(
item=c("G,S,GS","G,S"),
timePeriod=c("1995:2000","2006),
refArea = c("DE,SE","DE,SE,SK,SI")
)
the result is something like:
test2 <- data.table(
item=c("G","G","S","G","G","G","G"),
timePeriod=c("1995","1995","1995","1995","2006","2006","2006"),
refArea = c("DE","SE","DE","SE","DE","SE","SK")
)
I did not put all the lines. Indeed I think I should use expand.grid somewhere.
How could I do that? Thanks