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).
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.
There seems to be something strange with your ID's if I am reading that PDF properly. A numeric ID of 1.03013e+12 is unusual to say the least. You may very well be running into numeric accuracy problems which may be what is giving you the millions.
I think we really need reproducible example (reprex) or at least some sample data. Have a look at
A handy way to supply sample data is to use the dput() function. See ?dput. Since you have relatively large data sets then something like head(dput(myfile), 100) for each data.frame will likely supply enough data for us to work with.