Re: [R] blank space escape sequence in R?

From: Mark Heckmann <mark.heckmann_at_gmx.de>
Date: Mon, 25 Apr 2011 20:09:09 +0200

Thanks, Matt!
"\x20" works great for me!

Am 25.04.2011 um 19:42 schrieb Matt Shotwell:

> 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.
>
>
末末末末末末末末末末末末末末末末末末末

Mark Heckmann
Blog: www.markheckmann.de
R-Blog: http://ryouready.wordpress.com

        [[alternative HTML version deleted]]



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. Received on Mon 25 Apr 2011 - 18:10:55 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 25 Apr 2011 - 18:30:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive