I'm sure there is a very easy way to accomplish this task, but I cannot seem to figure it out. I have two data frames which have the exact same data but from two separate locations.
df1 <- data.frame(a=c(1,2,3,NA),b=c(1,5,4,6))
df2 <- data.frame(a=c(3,4,5,6),b=c(7,8,9,NA))
My desired output is two have a new version of df1 and df2 which are the exact same but the bottom row only contains NA values. I.e. if there is an NA value in one data frame, I need that replicated on the corresponding cell in the other data frame...
df1[4,2] <- NA
df2[4,1] <- NA
I have seen very similar questions addressing the problem from the opposite perspective (e.g. Filling missing values in a data.frame from another data.frame) but I can't figure how to apply this to my own data. Thank you in advance.