Replace missing values (NA) in one data set with values from another where columns match
问题 I have a data frame (datadf) with 3 columns, 'x', 'y, and z. Several 'x' values are missing ( NA ). 'y' and 'z' are non measured variables. x y z 153 a 1 163 b 1 NA d 1 123 a 2 145 e 2 NA c 2 NA b 1 199 a 2 I have another data frame (imputeddf) with the same three columns: x y z 123 a 1 145 a 2 124 b 1 168 b 2 123 c 1 176 c 2 184 d 1 101 d 2 I wish to replace NA in 'x' in 'datadf' with values from 'imputeddf' where 'y' and 'z' matches between the two data sets (each combo of 'y' and 'z' has