【问题标题】:Print matching words of two columns in R在R中打印两列的匹配词
【发布时间】:2020-10-05 15:07:13
【问题描述】:

我有 2 个具有用户名的数据框。

输入1

username
akshay
bhanu
catherine
dennis

输入2

username
akshay
bhanu
catherine
dennis
edward
francis

我必须找到 2 列的匹配词。两列都有大约 120 多个名字,我只是举了几个例子。我尝试了几种方法,但它说数据帧的长度不同。

【问题讨论】:

  • 我不太明白你是有两个数据框还是一个有两列的数据框
  • 这能回答你的问题吗? Matching two Columns in R

标签: r dplyr multiple-columns string-comparison string-matching


【解决方案1】:

您可以使用 dplyr 包中的过滤器功能。

input1 = filter(username %in% input2$username)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-07-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多