my data is like -17+3 2-6 what i need to do is separate each one into two numbers for example: -17+3 into \"-17\" and \"3\" 2-6 into \"2\" and \"-6\" by using R
many man
gregexpr and regmatches to the rescue:
text = '-17+6' pattern = '[+-]\\d+' matches = gregexpr(pattern, text) regmatches(text, matches) # [[1]] # [1] "-17" "+6"