To get candidate join columns in R, you can use the select()
function from the dplyr
package to choose columns that are common between data frames that you want to join.
Here's an example:
main.r441 chars14 lines
In the example above, join_cols
is a vector that contains the name(s) of the column(s) that we want to use as the join key(s) between df1
and df2
. We use the inner_join()
function to merge the two data frames based on the join column(s), resulting in a new data frame merged_df
.
gistlibby LogSnag