I am trying to fill in table1 with matching val2 values of table2
table1$New_val2 = table2[table2$pid==table1$pid,]$val2
But I get the warning
longer object length is not a multiple of shorter object length
which is fair enough because the table lengths are not the same.
Please kindly direct me on the correct way to do this.