Re: [R] Handling character string

From: Bert Gunter <gunter.berton_at_gene.com>
Date: Fri, 11 Jun 2010 14:22:21 -0700

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.

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. Received on Fri 11 Jun 2010 - 21:24:50 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 11 Jun 2010 - 22:00:32 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive