s = "abc 12345 def"
sub("([0-9]{2})([0-9]{3})", "\\1-\\2", s)
# "abc 12-345 def"
This will find first instance of 5 numbers in a row and add a "-" after the second number. See http://stat.ethz.ch/R-manual/R-patched/library/base/html/regex.html for R regex syntax.