[R] blank space escape sequence in R?
Matt Shotwell
matt at biostatmatt.com
Mon Apr 25 19:42:00 CEST 2011
I may have misread your original email. Whether you use a hex escape or
a space character, the resulting string in memory is identical:
> identical("a\x20b", "a b")
[1] TRUE
But, if you were to read a file containing the six characters "a
\x20b" (say with readLines), then the six characters would be read into
memory, and printed like this:
"a\\x20b"
That is, not with a space character substituted for \x20. So, now I'm
not sure this is a solution.
On Mon, 2011-04-25 at 12:24 -0500, Matt Shotwell wrote:
> You can embed hex escapes in strings (except \x00). The value(s) that
> you embed will depend on the character encoding used on you platform. If
> this is UTF-8, or some other ASCII compatible encoding, \x20 will work:
>
> > "foo\x20bar"
> [1] "foo bar"
> >
>
> For other locales, you might try charToRaw(" ") to see the binary (hex)
> representation for the space character on your platform, and substitute
> this sequence instead.
>
> On Mon, 2011-04-25 at 15:01 +0200, Mark Heckmann wrote:
> > Is there a blank space escape sequence in R, i.e. something like \sp etc. to produce a blank space?
> >
> > TIA
> > Mark
> > –––––––––––––––––––––––––––––––––––––––
> > Mark Heckmann
> > Blog: www.markheckmann.de
> > R-Blog: http://ryouready.wordpress.com
> >
> > ______________________________________________
> > 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