'Editing Data frames in R and formatting

I was wondering how I can edit my data frame. I have a data frame like the one below.

   ID    Value
  A1_5    5.6
  A2_7    3.4
  A3_8    6.7 

I want to duplicate the IDs by changing the first letter, and repeating the same value since they are coming from the same samples. So I want to create a data frame such as...

   ID    Value
  A1_5    5.6
  B1_5    5.6
  A2_7    3.4
  B2_7    3.4
  A3_8    6.7 
  B3_8    6.7 

How can I go about doing this?

Thank you in advance.

r


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source