Displaying 1 result from an estimated 1 matches for "byripley".
Did you mean:
bripley
2005 Sep 15
2
Splitting the string at the last sub-string
Hi,
I need to split a string into 2 strings, with the split point defined by the
last occurrence of some substring. I come up with some convoluted code to do
so:
str = "Chance favors the prepared mind"
sub = "e"
y = unlist(strsplit(str,sub))
z = cbind(paste(y[-length(y)], sub, sep="", collapse = ""), y[length(y)]);
y
z
z[1]
z[2]
Is there a simpler way