name cats happiness_level
Leo 5 10
I have data like the above.. and essentially I want to uncount, but only ensure one row has happiness level of 10. the others should have happiness level 0 or NA. is there an easy way to do this? I am doing this to create a weighted average, where one cat is weighted 10 happiness level, but the other 4 cats have 0 happiness level
so this is what I want as the output somehow..
name cats happiness_level
Leo 1 10
Leo 1 0
Leo 1 0
Leo 1 0
Leo 1 0