Re: [R] Tell the difference between characters

2011-04-26 Thread Lisa
Yes. That is what I want. Thank you very much. Lisa -- View this message in context: http://r.789695.n4.nabble.com/Tell-the-difference-between-characters-tp3476130p3476288.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-proje

Re: [R] Tell the difference between characters

2011-04-26 Thread Lisa
Thanks a lot. Lisa -- View this message in context: http://r.789695.n4.nabble.com/Tell-the-difference-between-characters-tp3476130p3476352.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.

Re: [R] Tell the difference between characters

2011-04-26 Thread Henrique Dallazuanna
Try this: sapply(apply(sapply(temp, charToRaw), 2, unique), length) == 1 On Tue, Apr 26, 2011 at 3:09 PM, Lisa wrote: > Dear all, > > I just want to determine if the characters in a character string are the > same or not. For example, > > temp <- c("aa", "aA", "ab") > > How do I determine the fi

Re: [R] Tell the difference between characters

2011-04-26 Thread jim holtman
This will handle varying length strings if you want to test for the same character: > temp <- c("aa", "aA", "ab") > x <- strsplit(temp, '') > x [[1]] [1] "a" "a" [[2]] [1] "a" "A" [[3]] [1] "a" "b" > sapply(x, function(z) all(z[1] == z)) [1] TRUE FALSE FALSE > On Tue, Apr 26, 2011 at 2:09 P

Re: [R] Tell the difference between characters

2011-04-26 Thread Sarah Goslee
Hi Lisa, On Tue, Apr 26, 2011 at 2:09 PM, Lisa wrote: > Dear all, > > I just want to determine if the characters in a character string are the > same or not. For example, > > temp <- c("aa", "aA", "ab") > > How do I determine the first one have the two same “a”, and the second and > third have th

Re: [R] Tell the difference between characters

2011-04-26 Thread Jorge Ivan Velez
Hi Lisa, Is this what you have in mind? > temp <- c("aa", "aA", "ab") > temp == temp[1] [1] TRUE FALSE FALSE HTH, Jorge On Tue, Apr 26, 2011 at 2:09 PM, Lisa <> wrote: > Dear all, > > I just want to determine if the characters in a character string are the > same or not. For example, > > tem

[R] Tell the difference between characters

2011-04-26 Thread Lisa
Dear all, I just want to determine if the characters in a character string are the same or not. For example, temp <- c("aa", "aA", "ab") How do I determine the first one have the two same “a”, and the second and third have the different characters? Thanks in advance. Lisa -- View this messa