Combine two dataframes that have common rows and columns (fill in)
Solution 1:
One possible way is to get the non-NA
values out of each column grouped by Ind
, and otherwise, leave (generate) an NA
full_join(TargetDF, tempDF) %>%
group_by(Ind) %>%
summarise_each(funs(.[!is.na(.)][1L]))
# Source: local data frame [3 x 3]
#
# Ind 2015 Act 2016 Act
# (dbl) (int) (int)
# 1 5 7870 NA
# 2 6 49782 323
# 3 7 NA NA