I have a data frame in the form of columns - input
Id Comment
xc545 Ronald is a great person
g6548 Hero worship is bad
I need the output in the form of Result
Id Words
xc545 Ronald
xc545 is
xc545 a
xc545 great
xc545 person
g6548 Hero
g6548 worship
g6548 is
g6548 bad
Need a R statement to execute this.
Following is what I tried -
result<-lapply(input,function(x)strsplit(x[2]," "))
However this returns only one record.