[R] Odp: problem with compating 2 strings

Petr PIKAL petr.pikal at precheza.cz
Thu Jan 22 11:44:40 CET 2009


Hi

r-help-bounces at r-project.org napsal dne 22.01.2009 10:49:26:

> Hi all,
> 
> I got one problem with compating charecterstrings with using  "=="
> can anyone suggest if any other way to compare two charecterstrings

Works for me

a<-letters
b<-letters[1:10]
> a==b
 [1]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE FALSE 
FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE 
FALSE FALSE
[26] FALSE
Warning message:
In a == b : longer object length is not a multiple of shorter object 
length

> a%in%b
 [1]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE FALSE 
FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE 
FALSE FALSE
[26] FALSE
>

Regards
Petr

> 
> thanks in advance
> 
>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> 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