Hhhhhmmmhhhhmm. > mystring <- "Man\\Woman" > cat(mystring) Man\Woman> > > mystring <- "Man\Woman" Fejl: '\W' is an unrecognized escape in character string starting ""Man\W" >
So was the OP asking about? We need some more information, thank you!. Yours sincerely / Med venlig hilsen Frede Aakmann Tøgersen Specialist, M.Sc., Ph.D. Plant Performance & Modeling Technology & Service Solutions T +45 9730 5135 M +45 2547 6050 fr...@vestas.com http://www.vestas.com Company reg. name: Vestas Wind Systems A/S This e-mail is subject to our e-mail disclaimer statement. Please refer to www.vestas.com/legal/notice If you have received this e-mail in error please contact the sender. > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Sarah Goslee > Sent: 3. juni 2014 20:18 > To: Adrian Dușa > Cc: r-help@r-project.org > Subject: Re: [R] detect escape character > > Hi, > > R uses \ as a metacharacter, so you need a non-intuitive number of \: > > > mystring <- "Man\\Woman" > # \\ is a metacharacter and a \, so it's equivalent to \ in normal text > sub("\\\\", "/", mystring) > > > Sarah > > > On Tue, Jun 3, 2014 at 2:03 PM, Adrian Dușa <dusa.adr...@unibuc.ro> wrote: > > Dear All, > > > > I should be knowing this, but not get it right... For a string like this: > > > > "Man\Woman" > > > > I would like to detect the escape character "\" and replace it with "/". > > > > Tried various ways using gsub(), but don't get it right yet. Any suggestion > > would be highly welcomed... > > > > Thank you, > > Adrian > > > > -- > Sarah Goslee > http://www.functionaldiversity.org > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.