[R] about strsplit
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Thu May 10 11:40:54 CEST 2001
Olivier Houix <Olivier.Houix at ircam.fr> writes:
> Hello,
> I want to split a string including a "+" but
> it seems there is no effect because of this special character.
> Just to explain, I convert frequencies to midi notes (external program)
> but I don't want to keep
> information about quater-tone!
>
> > s <- c("Fd4+1/4") (i't a note!)
> > strsplit(s,"+")
> [[1]]
> [1] "F" "d" "4" "+" "1" "/" "4"
Read up on regular expressions (or see the last example on the help
page) and:
> s <- "Fd4+1/4"
> strsplit(s,"\\+")
[[1]]
[1] "Fd4" "1/4"
--
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
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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