[R] Finding the common portion of strings

Dennis Fisher fisher at plessthan.com
Fri Mar 25 18:27:33 CET 2011


Colleagues

R: 2.12.2
OS X

I have a set of text objects in the form (I am showing 3 of what is more likely to be 20 or so):
	OBJECTS	<- c("abcSOMETHINGCOMMONegf", "xSOMETHINGCOMMONyz", "SOMETHINGCOMMONnme")

As you can see, all contain "SOMETHINGCOMMON" and the position varies.  But, I don't know what that "SOMETHINGCOMMON" is.

Is there an efficient means to find the common string of characters between all of the objects?

Dennis

Dennis Fisher MD
P < (The "P Less Than" Company)
Phone: 1-866-PLessThan (1-866-753-7784)
Fax: 1-866-PLessThan (1-866-753-7784)
www.PLessThan.com



More information about the R-help mailing list