I have multiple dataframes with different column names in each dataframe and would like to do a random match by taking some values from each column, and match it to all columns in my list of dataframes. The purpose behind this is to identify which columns are linked (to allow easier merging after).
Does someone know a way to do this in R?
sales <- data.frame(r1 = c(10, 10.5, 30.1), r2 = c("ID1","ID2","ID3"))
purchases <- data.frame(cost = c(29.9, 11.5, 33.1), ID = c("ID1","ID2","ID3"), product_id = c("X1", "X2", "X3"))
product <- data.frame(admin_ID = c("X1", "X2", "X3"), name = c("ID1","ID2","ID3"))
From the data, you can see that Sales:r2 = purchases:ID = product:name AND Sales:product_id = product:admin_ID.
The match should only be performed on character variables.