[R] string manipulation in R?

Paul Murrell p.murrell at auckland.ac.nz
Thu Jul 19 00:50:31 CEST 2001


Hi


> [Quick version]
> How do I concatenate two string to produce a third?
> Does the underlying representation of "character" allow this?


[Quick answer]
For concatenating strings, use paste().  For example ...

    > paste("any", "number", "of", "strings")
    [1] "any number of strings"
    > paste("any", "number", "of", "strings", sep="")
    [1] "anynumberofstrings"

... and there are other "nifty" string manipulators such as substr(),
nchar(), and strsplit(), and even grep(), regexpr(), sub(), and gsub()

Paul




-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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