[R] Removing special chars in strings?
William Dunlap
wdunlap at tibco.com
Thu Sep 1 03:50:04 CEST 2011
Typo below:
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of William Dunlap
> Sent: Wednesday, August 31, 2011 6:47 PM
> To: . .; R-help at r-project.org
> Subject: Re: [R] Removing special chars in strings?
>
> There are no backslash characters in the string "bla\ble\bli".
> "\b" is used to indicate a backspace character, just
> as "\n" is used to indicate a newline character.
>
> You can get rid of the XbackslashX characters with
backspace
> > gsub("\b","","bla\ble\bli")
> [1] "blaleli"
> or change them to b's with
> > gsub("\b","b","bla\ble\bli")
> [1] "blablebli"
>
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com
>
> > -----Original Message-----
> > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of . .
> > Sent: Wednesday, August 31, 2011 6:33 PM
> > To: R-help at r-project.org
> > Subject: [R] Removing special chars in strings?
> >
> > Hi all,
> >
> > How can I replace those "\" in the str?
> >
> > Thanks in advance.
> >
> > func <- function(str) {
> > print(gsub("\\","",str))
> > }
> > func("bla\ble\bli")
> >
> > ______________________________________________
> > R-help at 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 at 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.
More information about the R-help
mailing list