Is there any way to replace range of numbers wih single numbers in a character string? Number can range from n-n, most probably around 1-15, 4-10 ist also possible.
the range could be indicated with a) -
a <- "I would like to buy 1-3 cats"
or with a word b) for example: to, bis, jusqu'à
b <- "I would like to buy 1 jusqu'à 3 cats"
The results should look like
"I would like to buy 1,2,3 cats"
I found this: Replace range of numbers with certain number but could not really use it in R.
gregexpr
andregmatches
. – Centumto
andbis
? – Shornick