Hi, thank you for answering my problem.
My data is in format as below:
I want the output or output should be :
Is any R package code available? perl or python code will also be great. Thank you very much. Sorry for wasting your valuable time.