[R] strings
Martin Maechler
maechler at stat.math.ethz.ch
Wed Oct 4 08:42:14 CEST 2000
>>>>> "KH" == Kurt Hornik <Kurt.Hornik at ci.tuwien.ac.at> writes:
>>>>> Richard Rowe writes:
>> I am attempting to analyse some behaviour sequence data. The input is
>> an alphabetic string "ASDFGH ... ". I wish to start at one end of the
>> string, peel off each character, and convert to an integer to develop
>> transition matrices etc. My blundering through the ref manual hasn't
>> produced any light.
>> Can this be done easily in R or should I pre-process?
>> I recollect an item similar to this on R-help around 6 mo ago but I
>> can't find it in the archive. If there is such an article can someone
>> please send me the date and I will track it down,
KH> Richard,
KH> Not sure what precisely you need ... if it is about converting a string
KH> to a vector of characters, you could use
R> x <- "ASDFGH"
R> x
KH> [1] "ASDFGH"
R> unlist(strsplit(x, NULL))
KH> [1] "A" "S" "D" "F" "G" "H"
KH> and proceed from there.
which reminds me that I've had a desire for something like
the old S function [from the blue book, and library(examples) I think]
ichar(ch)
which would return a vector of integers, each the (decimal) equivalent of
the (ISO-latin1) representation of the corresponding characters in ch.
This should be easy enough (and be done in C).
Any volunteers?
Martin Maechler <maechler at stat.math.ethz.ch> http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum LEO D10 Leonhardstr. 27
ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND
phone: x-41-1-632-3408 fax: ...-1228 <><
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list