Thank you Ista,
Your solution is smart, by sub-setting from x.HHu.map data only HHid,
position as indices (because they are unique) for the merge, and any
extra columns in x.HHu.map that are not present in y.HHo,map, thus when
the merge is done with option all=T, will work among the two sets of
Thank you Jeff,
Your solutions have two great aspects: a) you provide a different
approach by using reshape2 syntax / tidyr, and b) the concern that it is
better to update x.HHu.map with y.HHo.map, without overwriting x.HHu.map
with NA from y.HHo.map, thus keeping intact the old value(s). That
I get confused by your use of the position map table. If I follow your
description toward your desired result, I take a different route that
makes sense to me. Perhaps it will make sense to you as well. The key idea
is to make individual comparisons of the values for each combination of
HHid
Hi,
I have two sets of data x.HHu and y.HHo, rows are IDs and columns are
individuals. I do not know in advance indv or HHid, both of them will be
captured from the data. As the y.HHo set updates, y.HHo set has better
information then x.HHu set. Thus I want a merge where right set
overwrites
I think this does what you want:
## find idiv coloumns in x.HHu.map that don't exist in y.HHo.map
x.HHu.map - x.HHu.map[
c(HHid,
position,
names(x.HHu.map)[
!names(x.HHu.map)
%in% names(y.HHo.map)]
)]
## merge, adding extra column from x.HHu.map
5 matches
Mail list logo