【发布时间】:2021-09-13 18:42:57
【问题描述】:
我的数据如下所示:
> head(df)
ID Comment
1 1 I ate dinner.
2 2 We had a three-course meal.
3 3 Brad came to dinner with us.
4 4 He loves fish tacos.
5 5 In the end, we all felt like we ate too much. Code 5.16
6 6 We all agreed; it was a magnificent evening.72 points.
我想创建两个新列,一个名为A,一个名为B。
如果出现以下任何单词/短语,我希望 A 列等于 1:dinner,evening,we ate
如果出现以下任何单词/短语,我希望 B 列等于 1:in the end,all,Brad,5.16。
我该怎么做呢?请注意,我需要完全匹配。
【问题讨论】: