I have problems working out the following function. I made a small example in the attached excel sheet.
We have a specific software package that produces reports with only a total amount of counts per department, given in the last record per department (by simple example in the thirst two columns).
What I need R to do, is give me a third vector with sequential numbering as in the example.
My apologies for my late reply. Yes your solution was OK, but worked only for my example. The real dataframe is much larger then the example so the 'amount' needs to be detected by R automatically instead of being filled in by the user.
I finally came up with this, which works for my entire data-set. (names of the vectors are different from the example. Thanks for thinking with me.