[R] A logical comparison between two character strings in R

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Thu Aug 21 16:32:15 CEST 2003


Lun Li <lun.li at glg.ed.ac.uk> writes:

> Dear All,
> 
> Does anyone know how to compare two character strings in R?  For eample, how 
> to compare "A-1-B" with "cc-10000" in logical ?

Ehhh... Is it this that you want?

>  "A-1-B" == "cc-10000"
[1] FALSE
>  "A-1-B" <= "cc-10000"
[1] TRUE
>  "A-1-B" > "cc-10000"
[1] FALSE
>  "d-1-B" > "cc-10000"
[1] TRUE


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list