s-news
[Top] [All Lists]

Re: comparing character vectors

To: "Dave Evens" <devens8765@yahoo.com>, <s-news@lists.biostat.wustl.edu>
Subject: Re: comparing character vectors
From: "Chalvatzis, Dimitrios (Energy Wholesale)" <Dimitrios.Chalvatzis@eon-uk.com>
Date: Mon, 22 Aug 2005 13:42:47 +0100
Thread-index: AcWnFQBZ4fecCLv0Rk6PG3qB4D7P+AAAee+w
Thread-topic: [S] comparing character vectors
Dave,
This is the command:

match(y,x)

Dimitrios Chalvatzis 
Risk Analyst 
Energy Wholesale/Risk Policies & Methods 
T +44 (0)24 7642 5429 
F +44 (0)24 7642 5479 
Dimitrios.Chalvatzis@eon-uk.com 


-----Original Message-----
From: s-news-owner@lists.biostat.wustl.edu
[mailto:s-news-owner@lists.biostat.wustl.edu] On Behalf Of Dave Evens
Sent: Monday, August 22, 2005 1:28 PM
To: s-news@lists.biostat.wustl.edu
Subject: [S] comparing character vectors


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 
--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu.  To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message:  unsubscribe s-news
___________________________ Disclaimer Notice ____________________
This message and any attachments are confidential and should only 
be read by those to whom they are addressed. If you are not the 
intended recipient, please contact us, delete the message from your
computer and destroy any copies. Any distribution or copying without
our prior permission is prohibited.

Internet communications are not always secure and therefore the 
E.ON Group does not accept legal responsibility for this message.
The recipient is responsible for verifying its authenticity before
acting on the contents. Any views or opinions presented are solely
those of the author and do not necessarily
represent those of the E.ON Group.

E.ON UK plc, Westwood Way, Westwood Business Park,
Coventry, CV4 8LG.
Registered in England & Wales No. 2366970

E.ON UK Trading Ltd, Westwood Way, Westwood Business Park,
Coventry, CV4 8LG
Registered in England & Wales No. 4178314

E.ON UK Trading Ltd is regulated by the Financial Services 
Authority to carry out investment activities.

Telephone +44 (0) 2476 42 4000
Fax +44 (0) 2476 42 5432

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