Hi,
Could you explain in a bit more detail what the final data structure would look like (generate a data frame with some mock values). I'm confused about the columns per ID.
- Do you want a separate data frame per id, or each ID a new column? The latter is not possible as the columns would be different length.
- Some IDs don't have last_counters so how would you handle that?
- What should happen if both are empty?
Again, please generate an example of the final table (or whatever you want to create) so we can see what you want. You can use the reprex guide to help you. A reprex consists of the minimal code and data needed to recreate the issue/question you're having. You can find instructions how to build and share one here:
Hope this helps,
PJ