I am attempting to merge two data frames using right join with dplyr but wondering if the cross join is what I should be using. I have read through multiple other related threads including this one which was helpful but to no avail.
In short, the right join works for me, but it reproduces the common variables between the two data frames as separate .x and .y variables. I just want to add a specific variable (column) from the left (x) data frame to the right (y) data frame (which has more rows/observations) matching on the "SUBJECT" key variable.
I am not sure how to modify the below code to achieve the desired result such that observations on the specific variable merged from the x data frame which does not have a value for this variable in the y data frame is "N/A". Of note, virtually all of the variables present in x are present in y (X is a subset of Y), but I only want to match on the SUBJECT variable. Below is my current code.
DF_merged <- right_join(DF.X, DF.Y, by = 'SUBJECT')