Hi R Community,
Thank you for your time.
I am unable to figure out a way to perform the following operation.
The logic for the operation is to break down a column to multiple rows with limits on each cell value.
for 1st row and second row max is 250. subsequent are 500 max. each value in amount should be broken down to multiple rows based on these set of rules.
for ex:- ID 1 has 1500 as amount. when being broken down. the first row and second row can allow max 250 as a values. and next rows accommodate the rest until the amount value is maxed out
Raw data | ||
---|---|---|
ID | Name | Amount |
1 | aa | 1500 |
2 | bb | 2000 |
3 | cc | 1000 |
4 | dd | 500 |
Final output | ||
ID | Name | Amount |
1 | aa | 250 |
1 | aa | 250 |
1 | aa | 500 |
1 | aa | 500 |
2 | bb | 250 |
2 | bb | 250 |
2 | bb | 500 |
2 | bb | 500 |
2 | bb | 500 |
2 | bb | 500 |
3 | cc | 250 |
3 | cc | 250 |
3 | cc | 500 |
4 | dd | 250 |
4 | dd | 250 |