R dplyr left join - multiple returned values and new rows: how to ask for the first match only?

后端 未结 1 971
悲哀的现实
悲哀的现实 2021-02-06 17:31

Let\'s say I have a list of suburb names, crime rate and their council names on a separate table.

\"Tables

1条回答
  •  孤城傲影
    2021-02-06 18:16

    You can do this using the plyr package and the join() function. The equivalent to left_join(table1, table2, by=Suburb) but only using the first Suburb match from table2 would be: join(table1, table2, by=Suburb, type="left", match="first"). I'm not sure what the equivalent is in the dplyr package, though I would love to know myself.

    0 讨论(0)
提交回复
热议问题