小编Sri*_*yer的帖子

删除 R 中另一列中存在的一列中的单词

我有一个这种格式的数据框:

A <- c("John Smith", "Red Shirt", "Family values are better")
B <- c("John is a very highly smart guy", "We tried the tea but didn't enjoy it at all", "Family is very important as it gives you values")

df <- as.data.frame(A, B)
Run Code Online (Sandbox Code Playgroud)

我的目的是将结果恢复为:

ID   A                           B
1    John Smith                  is a very highly smart guy
2    Red Shirt                   We tried the tea but didn't enjoy it at all
3    Family values are better    is very important as it gives …
Run Code Online (Sandbox Code Playgroud)

regex r dataframe

5
推荐指数
1
解决办法
1386
查看次数

标签 统计

dataframe ×1

r ×1

regex ×1