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

Re: [R] String Comparison

2010-01-31 Thread Jorge Ivan Velez
How about union() ? > a <- as.character(c("a", "b", "c", "d", "e")) > b <- as.character(c("d", "a", "c", "e", "f", "b")) > > union(a,b) [1] "a" "b" "c" "d" "e" "f" HTH, Jorge On Sun, Jan 31, 2010 at 10:31 PM, stephen sefick <> wrote: > a <- as.character(c("a", "b", "c", "d", "e")) > b <- as.cha

[R] String Comparison

2010-01-31 Thread stephen sefick
a <- as.character(c("a", "b", "c", "d", "e")) b <- as.character(c("d", "a", "c", "e", "f", "b")) How would I get a list of only the unique values of these two character vectors. I would like the output a b c d e f there is no reason to have these in order. I am looking at to character vectors of