Dear stackoverflow users,
Many people encounter situations in which they need to modify strings. I have seen many posts related to string modification. But, I have not come across solutions I am looking for. I believe my post would be useful for some other R users who will face similar challenges. I would like to seek some help from R users who are familiar with string modification.
I have been trying to modify a string like the following.
x <- "Marcus HELLNERJohan OLSSONAnders SOEDERGRENDaniel RICHARDSSON"
There are four individuals in this string. Family names are in capital letters. Three out of four family names stay in chunks with first names (e.g., HELLNERJohan). I want to separate family names and first names adding space (e.g., HELLNER Johan).
I think I need to state something like "Select sequences of uppercase letters, and add space between the last and second last uppercase letters, if there are lowercase letters following."
The following post is probably somewhat relevant, but I have not been successful in writing codes yet.
Splitting String based on letters case
Thank you very much for your generous support.