I have three variables.
va1 and var2 are names, eg. of database tables.
var3 stores (in a string) the column(s) of the database tables which are necessary to join the two tables.
Without any loss of generality: Each Database table has only one colum to join with another database.
Is it possible in R/ dplyr to get a martix / tibble where var1 are the rows, var2 are the columns and var3 is the value of the var1*var2 combination?
An example dataframe:
df <- data.frame(var1 = paste0("tab",c(seq(1:5),1,1)),
var2 = paste0("tab",c(2,4,5,3,1,3,4)),
var3 = letters[1:7])
Expected result:
tab1 tab2 tab3 tab4 tab5
tab1 - a f g -
tab2 - - - b -
tab3 - - - - c
tab4 - - d - -
tab5 e - - - -
How to get it?
Thank you!