s-news
[Top] [All Lists]

comparing character vectors

To: s-news@lists.biostat.wustl.edu
Subject: comparing character vectors
From: Dave Evens <devens8765@yahoo.com>
Date: Mon, 22 Aug 2005 05:27:59 -0700 (PDT)
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=Fw3IP41DNOtPhxl4SBjtNIYQLARfSSmC+WMgjaZetH2+idklrw8FwgaPacl5ld01w1QuiBo39IylR/eszhF/8MixkzmxsLOkfKUy4+HNJ6kLBTmDOKD8d1oaoz1hvh1/3S0HerwYKt9rfj1+x+ZDANxZ+cGvFld6nnjCLaOwRP8= ;
Dear all,

I would like to compare to 2 character vectors, where
one is a subset of the other. For example, suppose

x <- LETTERS[1:20]
and
y <- c("E", "H", "N", "Q", "R")

I would like to know where the elements of y occur in
x, i.e. in this example

5 8 14 17 18

Is there a command that does this?

Thanks in advance for any help.

Dave

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

<Prev in Thread] Current Thread [Next in Thread>