[R] Removing any text beginning with...

2009-05-11 Thread Amélie Baud
Hi !

From an Ensembl annotation like ENSG /// ENSGy /// ENSG, I am 
trying to keep only the first part: ENSG. I wasn't able to find any 
helpful information about how to do it. Could you help me with that please ? 
Is the use of the equivalent to the Excel * (any text) a good way of doing it 
and how ? 
Your help will be very much appreciated.

Amelie



  
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Removing any text beginning with...

2009-05-11 Thread jim holtman
Is this what you want (using regular expressions):

 x - ENSG /// ENSGy /// ENSG
 sub(^([[:alpha:]]+).*, \\1 file://0.0.0.1/, x)
[1] ENSG




On Mon, May 11, 2009 at 9:01 AM, Amélie Baud ameli...@yahoo.fr wrote:

 Hi !

 From an Ensembl annotation like ENSG /// ENSGy /// ENSG, I am
 trying to keep only the first part: ENSG. I wasn't able to find any
 helpful information about how to do it. Could you help me with that please ?
 Is the use of the equivalent to the Excel * (any text) a good way of doing
 it and how ?
 Your help will be very much appreciated.

 Amelie




[[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.