[R] ? Exact pattern matching in GREP ?
Derek Eder
Derek.Eder at neuro.gu.se
Fri Sep 27 16:05:51 CEST 2002
How is exact pattern matching achieved in GREP (and GREPlike) functions ?
# Want: listing of all object names that end in *.lm
> objects(pattern="*.lm",pos=1)
# ... but get: all objects that partially match *.lm, e.g., *.lme
[1] "j3.lm" "J3.lme" "j8.lm" "J8.lme"
# Want: position of string "4jan2002" in vector
> date.index <- grep("4jan2002", my.dates)
# .... but get:
> my.dates[date.index]
[1] "4jan2002" "24jan2002" "14jan2002"
Thank you.
Derek N. Eder
Göteborgs Universitet
Institutionen för klinisk neurovetenskap
Klinisk Neurofysiologi
Sahlgrenska universitetssjukhuset SS/SU
Blå straket 7, vån 3
SE 413 45 Göteborg
Sverige
Tlf. +46 (031) 34 244 14 (office) NYT!
Tlf. +46 (031) 34 212 83 (laboratory)
Tlf. +46 0709 / 7 212 83 (mobil)
Fax. +46 (031) 82 81 63
derek.eder at neuro.gu.se
Gothenburg University
Institute of Clinical Neuroscience,
Department of Clinical Neurophysiology
Salhgrenska Hospital SU/SS
SE 413 45 Göteborg
Sweden
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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