s-news
[Top] [All Lists]

Re: pattern

To: "Pravin Jadhav" <pravinj@gmail.com>, "s-news" <s-news@lists.biostat.wustl.edu>
Subject: Re: pattern
From: "Chalvatzis, Dimitrios (Energy Wholesale)" <Dimitrios.Chalvatzis@eon-uk.com>
Date: Tue, 16 May 2006 16:58:56 +0100
Thread-index: AcZ5AEZr5qHzhcW7SZGinTrvvtGJ5AAASkRA
Thread-topic: [S] pattern

You almost had it:

 

test1<-substituteString("\\+", "", test1,global=T)

attr(regexpr("[A-Z]+",test1), "match.length")

 

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

 


From: s-news-owner@lists.biostat.wustl.edu [mailto:s-news-owner@lists.biostat.wustl.edu] On Behalf Of Pravin Jadhav
Sent: Tuesday, May 16, 2006 4:48 PM
To: s-news
Subject: [S] pattern

 

Hello,

 

I have the following vector

> test1<-c("A+B", "A+C+D", "A+G+B")

I am interested in knowing the number of letters in each character string. The output should be (2, 3, 3).

 

I can do this when there is no "+" sign in between

>test2<-c("AB","ACD","AGB")

>attr(regexpr("[A-Z]+",test2), "match.length")

[1] 2 3 3

 

I am wondering how to obtain similar output for "test1". Any pointers are appreciated.

 

Pravin

 

___________________________ 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 authorised and regulated by the Financial Services
Authority to carry out energy investment activities.

Telephone +44 (0) 2476 42 4000
Fax +44 (0) 2476 42 5432
<Prev in Thread] Current Thread [Next in Thread>
  • pattern, Pravin Jadhav
    • Re: pattern, Chalvatzis, Dimitrios (Energy Wholesale) <=
    • Re: pattern, Biggerstaff, Brad J. (CDC/NCID/VBI)