I have a string vector that looks like this:
> string_vec [1] "XXX" "Snakes On A Plane" "Mask of the Ninja" "Ruslan" [5] "Kill Switch" "Buddy Holly Story, The" "Believers, The" "Closet, The" [9] "Eyes of Tammy Faye, The" "Gymnast, The" "Hunger, The"
At the end there are some names containing ", The". I want to remove the comma and space and move "The" in front of the rest of the text.
For example, "Buddy Holly Story, The" becomes "The Buddy Holly Story".
Isolation of drawing records was simple:
string_vec[grepl("[Aa-zZ]+, The", string_vec) == TRUE]
How to change position now?
data
string_vec <- c("XXX", "Snakes On A Plane", "Mask of the Ninja", "Ruslan", "Kill Switch", "Buddy Holly Story, The", "Believers, The", "Closet, The", "Eyes of Tammy Faye, The", "Gymnast, The", "Hunger, The")