[R] replacing text

Marc Schwartz mschwartz at medanalytics.com
Fri Jul 12 21:34:05 CEST 2002


> -----Original Message-----
> From: Thomas Lumley [mailto:tlumley at u.washington.edu]
> Sent: Friday, July 12, 2002 2:27 PM
> To: Marc Schwartz
> Cc: r-help at r-project.org
> Subject: Re: [R] replacing text
> 
> On Fri, 12 Jul 2002, Marc Schwartz wrote in reply to>>
> > >> 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..
> <snip>
> >
> > Be Careful!  The "_" character is an assignment operator!
> >
> > gh_i
> >
> > is the same as
> >
> > gh <- i
> >
> 
> but only if you evaluate it.  This sort of transformation might often
be
> needed in transferring data to/from another system where "." is
special
> but "_" isn't. It's done (in C code) in read.dta/write.dta in the
foreign
> package, for example.
> 
> 	-thomas

Very true. Thanks for elaborating on this.

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