小编Luc*_*hon的帖子

字符串拆分data.table列生成NA

这是我关于SO的第一个问题,请告诉我是否可以改进.我正在研究R中的自然语言处理项目,并且正在尝试构建包含测试用例的data.table.在这里,我构建了一个简化的示例:

texts.dt <- data.table(string = c("one", 
                                  "two words",
                                  "three words here",
                                  "four useless words here", 
                                  "five useless meaningless words here", 
                                  "six useless meaningless words here just",
                                  "seven useless meaningless words here just to",
                                  "eigth useless meaningless words here just to fill",
                                  "nine useless meaningless words here just to fill up",
                                  "ten useless meaningless words here just to fill up space"),
                       word.count = 1:10,
                       stop.at.word = c(0, 1, 2, 2, 4, 3, 3, 6, 7, 5))
Run Code Online (Sandbox Code Playgroud)

这将返回我们将要处理的data.table:

                                                          string word.count stop.at.word
 1: …
Run Code Online (Sandbox Code Playgroud)

string text-processing r data.table

7
推荐指数
3
解决办法
135
查看次数

标签 统计

data.table ×1

r ×1

string ×1

text-processing ×1