And I cannot, for the life of me, get it to work with my dataset.
It works with small throwaway datasets that I create, but if I use my dataset or any subset of it, it no longer works.
I apologize for the inconvenience, but I am unable to provide the dataset in question due to confidentiality agreements.
So we can then concentrate on the problem you have which is not with tidyr, but somewhere else. First rule of debugging - isolate. Does it still behave the same way if you leave only one variable in your vars_to_fill vector? Does it work for some column, but not others? Is there a combination that reliably produces wrong result? Does it work with, for example, 10 rows?
That being said, I don't know your dataset, but I would imagine (based on the names ID and time) that you can try to make a very small example with no real data. ID can be a vector 1:10, time can be created on the fly too. Variables in vars_to_fill are more difficult to understand, but I'm sure they can be mocked too.