I have some text like the following:
foo_text <- c(
"73000 PARIS 74000 LYON",
"75 000 MARSEILLE 68483 LILLE",
"60 MARSEILLE 68483 LILLE"
)
I'd like to separate each element in two after the first word. Expected output:
"73000 PARIS" "74000 LYON" "75000 MARSEILLE" "68483 LILLE" "60 MARSEILLE" "68483 LILLE"
Note that the number of spaces between two elements in the original text is not necessarily the same (e.g the number of spaces between PARIS and 74000 is not the same than the number of spaces between MARSEILLE and 68483). Also, sometimes the first number has a space in it (e.g 75 000) and sometimes not (e.g 73000).
I tried to adapt this answer but without success:
(delimitedString = gsub( "^([a-z]+) (.*) ([a-z]+)$", "\\1,\\2", foo_text))
Any idea how to do that?