Hi there,
I have two dataframes with the sames ID's, same foods, but different values of intake. The two dataframes both consist of 2184 observations.
What I want to do is to merge the ID's and foodgroups so that I can calculate the difference between the intake over time. I've done it multiple times, but this time it just doesn't work. This is how data looks like (I've also attached it).
df55_1
ID Food Intake
1 Cashewnuts 2
2 Bread 1
3 Cassava 2
df55_3
ID Food Intake
1 Rice 1
2 Potatoes 1
3 Cassava 2
What I have done is this: merge(df55_1, df55_3,by="Fødevare") and also by "ID".
This code gives me a dataset with like a million observations, when only there should be the original 2184.
Can anybody help?
Rkode.pdf (159.9 KB)