Skip to content
Back to formatted view

Raw Message

Message-ID: <16251.62444.934058.897390@gargle.gargle.HOWL>
Date: 2003-10-02T09:46:20Z
From: Martin Maechler
Subject: pmatch questions
In-Reply-To: <009701c388c4$174262a0$5c13070a@PROCGEN>

>>>>> "Vito" == Vito Muggeo <vito.muggeo at giustizia.it>
>>>>>     on Thu, 2 Oct 2003 11:03:38 +0200 writes:

    Vito> Dear all,
    Vito> Below there are two, simple - I suppose, questions on using pmatch():

    >> pmatch("xx", c("cc","xxa"))
    Vito> [1] 2
    >> pmatch("a", c("cc","xxa"))
    Vito> [1] NA
    >> pmatch("xx", c("cc","xxa","xxb"))
    Vito> [1] NA

    Vito> I would like that the second call returns also 2, and
    Vito> the third call returns c(2,3) is it possible?

yes, if you use  grep() instead of pmatch()

{and grep() *is* mentioned in the "See Also" section of
 help(pmatch) which you have consulted before asking, right ?}

    Vito> many thanks

you're welcome.
Martin