Replace a string and duplicate all rows containing it in R : I have a data.table in R, where I would like to duplicate rows m times and replace a 'string' to 'string'_(m times).

Example table:

Input Table:
[![enter image description here][1]][1]
If number of repetitions is m ( say, m=2) then I would need the output table to look like this:
[![enter image description here][2]][2]
So for every row with OrderId, the output table should have m rows, where the OrderId is changed to OrderId_(1 to m) , like OrderId_1, OrderId_2 etc. The change should also happen to the ProdId field where there is OrdId prefix.

And the quantity needs to be incremented by 1 for every new row


  [1]: https://i.stack.imgur.com/w2EP7.png
  [2]: https://i.stack.imgur.com/dvNfU.png

Please guide me how to approach this in R. Any pointers would be of great help. Thank you.