我有一个列形式的数据框 - 输入
Id Comment
xc545 Ronald is a great person
g6548 Hero worship is bad
我需要结果形式的输出
Id Words
xc545 Ronald
xc545 is
xc545 a
xc545 great
xc545 person
g6548 Hero
g6548 worship
g6548 is
g6548 bad
需要一个 R 语句来执行它。
以下是我尝试过的 -
result<-lapply(input,function(x)strsplit(x[2]," "))
但是,这仅返回一条记录。