[R] Finding the common portion of strings

From: Dennis Fisher <fisher_at_plessthan.com>
Date: Fri, 25 Mar 2011 10:27:33 -0700


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



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri 25 Mar 2011 - 17:32:26 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 25 Mar 2011 - 21:00:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive