Skip to content

is there a function like %in% for characters?

4 messages · Liaw, Andy, Terry Mu, Rich FitzJohn +1 more

#
I suppose here's one way:
[1] TRUE
[1] FALSE

Andy
#
thx, that's perfect. I thought of grep(), it also can do this.

I wonder if there is a document or book that explains things
categorically so it's easy to look up a function.
On Apr 2, 2005 10:54 PM, Liaw, Andy <andy_liaw at merck.com> wrote:
#
Or, using the %foo%-style functions:

"%charin%" <- function(x, y) regexpr(x, y) != -1
[1] TRUE
[1] FALSE

Cheers,
Rich
On Sat, 2 Apr 2005 22:54:35 -0500, "Liaw, Andy" <andy_liaw at merck.com> wrote:
1 day later
#
On Sat, 2 Apr 2005 23:00:43 -0500, Terry Mu <muster at gmail.com> wrote :
The HTML help does this:  try help.start(), and look at "search engine
and keywords".  

help.search() also has a keyword argument, but you need to know the
keywords to know what to look for.  ?help.search shows you how to find
them.

Duncan Murdoch