Re: [R] String comparison, trailing blanks make a difference.

2014-07-19 Thread Hadley Wickham
If you have unicode strings, you may need to do even more because there are often multiple ways of representing the same glyph. I made a little demo at http://rpubs.com/hadley/unicode-normalisation, since any unicode characters are likely to get mangled by email. Hadley On Fri, Jul 18, 2014 at 11

Re: [R] String comparison, trailing blanks make a difference.

2014-07-19 Thread John McKown
On Fri, Jul 18, 2014 at 11:17 AM, John McKown wrote: > Well, this was a shock to me. And I don't really see any documentation > about it, but perhaps I just can't see it. > >>"abc" == "abc " > [1] FALSE > > I guess that I thought of strings in R like I do is some other > languages where the shorte

Re: [R] String comparison, trailing blanks make a difference.

2014-07-18 Thread Hervé Pagès
Hi John, On 07/18/2014 09:17 AM, John McKown wrote: Well, this was a shock to me. And I don't really see any documentation about it, but perhaps I just can't see it. "abc" == "abc" [1] FALSE I guess that I thought of strings in R like I do is some other languages where the shorter value is p

Re: [R] String comparison, trailing blanks make a difference.

2014-07-18 Thread William Dunlap
>>"abc" == "abc " > [1] FALSE R does no interpretation of strings when doing comparisons so you do have do your own canonicalization. That may involve removing trailing, leading, or all white space or punctuation, converting to lower or upper case, mapping nicknames to official names, trimming to

[R] String comparison, trailing blanks make a difference.

2014-07-18 Thread John McKown
Well, this was a shock to me. And I don't really see any documentation about it, but perhaps I just can't see it. >"abc" == "abc " [1] FALSE I guess that I thought of strings in R like I do is some other languages where the shorter value is padded with blanks to the length of the longer value, th