[R] replacing text
Marc Schwartz
mschwartz at medanalytics.com
Fri Jul 12 20:05:09 CEST 2002
>> Position and number of dots vary, and not follow specific pattern.
>> I wish to replace all the dots by "_" in vect, so that it
>> looks like
>> "a_bcd_ef","gh_i", etc..
>Try:
>gsub("\\.","_",vect)
>> vect
>[1] "a.bcd.ef" "gh.i" "foo.blah" "test.another"
>> gsub("\\.","_",vect)
>[1] "a_bcd_ef" "gh_i" "foo_blah" "test_another"
>>
>Is this what you were looking for?
>-Jeff
Be Careful! The "_" character is an assignment operator!
gh_i
is the same as
gh <- i
or the same as
gh = i
HTH.
Marc
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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