I have a vector a strings with a number of spaces in. I would like to split this into two vectors split by the final space. For example:
vec <- c(\'This i
Here is one way using a lookahead assertion:
do.call(rbind, strsplit(vec, ' (?=[^ ]+$)', perl=TRUE)) # [,1] [,2] # [1,] "This is" "one" # [2,] "And" "another" # [3,] "And one more" "again"