I have a character object in R which is made of 200 words (a paragraph). I need to find all the cases that are a combination of number-space-character in all over the text and replace it with number-dash-character. For example, if the text says "the summer of 2019 was the hottest summer ever", I need to convert it to "the summer of-2019 was the hottest summer ever". What is an efficient way to do this (actually I have to do this to thousands of paragraphs)?
text <- "the summer of 2019 was the hottest summer ever"
some_function(text)
[1] "the summer of-2019 was the hottest summer ever"