Here, in the above example, Group3 has 5 rows. So, it would be divided into two groups consisting
of first 4 rows as a new group and remaining 1 row as another group
I want to have an output like this (Please ignore Temp value in the expected doutput)
Easy enough using the dplyr::row_number() function. This gives us the row number of each record, which when used with group_by resets the count for each group. This lets us identify when we have too many rows. I don't know if you need to adjust the group id of all the subsequent groups as you do in your example, so I made things a little simpler by just adding a sub group suffix for the new group notation.
As a side note dplyr::n() will tell you how many total rows are in each group.