I have a table as follows:
yel <- data.table(id=c(1,2,3))
yel$names[1] <- "\"parking space\", \"dining\", \"3bh\""
yel$names[2] <- "\"parking\" , \"outdoor\""
yel$names[3] <- "\"Hello!\",\"dining room\",\"3bh\""
yel
id names
1: 1 "parking space", "dining", "3bh"
2: 2 "parking" , "outdoor"
3: 3 "Hello!","dining room","3bh"
I was to dummify the names variable and join the same words like parking space with parking and also dining room with dining.
I want the dummy variables as follows: parking , dining, 3bh , outdoor, hello. Is there any method that does this?