[R] Handling character string

Bert Gunter gunter.berton at gene.com
Fri Jun 11 23:22:21 CEST 2010


I think the poster wants ?regex. 

Bert Gunter
Genentech Nonclinical Biostatistics
 
 

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Erik Iverson
Sent: Friday, June 11, 2010 2:06 PM
To: Megh Dal
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] Handling character string



Megh Dal wrote:
> Dear all, Is there any R function to say these 2 character strings
> "temp"  and " temp" are actually same? If I type following code R
> says there are indeed different :
>> "temp"  == " temp"[1] FALSE

You don't say how you're defining "same", but it definitely requires 
more explanation, since they are not the same.  Why should those two 
strings be the same in your mind?  Do you want to remove leading white 
space, all white space, just one space, etc?

You might find the examples in ?sub useful.

______________________________________________
R-help at 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.



More information about the R-help mailing list