[R] program to recognize words

Gabor Grothendieck ggrothendieck at gmail.com
Mon May 14 18:09:33 CEST 2007


Do you mean you want to separate out each sequence of characters that does
not contain whitespace?  scan can do that:

> Line <- "if C325=. then C743=(C152/C103)*100| else C743=(C152/C325)*100"
> scan(textConnection(Line), what = "")
Read 6 items
[1] "if"                    "C325=."                "then"
[4] "C743=(C152/C103)*100|" "else"                  "C743=(C152/C325)*100"


On 5/14/07, elyakhlifi mustapha <elyakhlifi_mustapha at yahoo.fr> wrote:
> hello,
> I need help because for my training I need to write a lil program which is able to read a line of character and it would recognize words
> for example for this line of character
>
> if C325=. then C743=(C152/C103)*100| else C743=(C152/C325)*100
>
> the program will be able to recognize the IF  ELSE syntaxe and the equations
> thanks
>
>
>      _____________________________________________________________________________
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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