[R] About counting letters.-

Freddy López folopez at ivic.gob.ve
Mon May 10 05:34:15 CEST 2010


Hi All,

I'm working with text processing and I have a problem. The problem is
the following:

I have a text, e.g.: 'R is a free software environment for statistical
computing and graphics.' and I need create a vector of characters such
that each position in the vector will be each letter in the text.

More precisely, I need obtain a vector as follow:

 "R" " " "i" "s" " " "a" " " "f" "r" "e" "e" " " "s" "o" "f" "t" "w"
"a" "r" "e" " " "e" "n" "v" "i" "r"
 "o" "n" "m" "e" "n" "t" " " "f" "o" "r" " " "s" "t" "a" "t" "i" "s"
"t" "i" "c" "a" "l" " " "c" "o" "m"
 "p" "u" "t" "i" "n" "g" " " "a" "n" "d" " " "g" "r" "a" "p" "h" "i" "c" "s" "."

(Similar to the returned value of the vector c("R", " " , "i",  "s", "
", "a", " ", "f" ,"r", "e" ,"e", " " , "s",  "o" , "f",  "t",  "w" ,
"a" , "r" , "e" ," " , "e" , "n" , "v",  "i"  ,"r"  ,"o"  ,"n" , "m",
"e",  "n",  "t" , " ",  "f", "o" ,"r" , " " ,"s" ,"t", "a" ,"t" ,"i"
,"s", "t" ,"i",  "c", "a", "l", " " ,"c" ,"o", "m", "p", "u", "t"
,"i", "n", "g", " " ,"a", "n" ,"d" ," " ,"g" ,"r" ,"a" ,"p" ,"h", "i",
"c", "s", ".") )

Does anybody have some idea to this?

Thanks.



More information about the R-help mailing list