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

From: Jan van der Laan <rhelp_at_eoos.dds.nl>
Date: Mon, 25 Apr 2011 16:37:15 +0200

There exists a non-breaking space:

http://en.wikipedia.org/wiki/Non-breaking_space

Perhaps you could use this. In R on Linux under gnome-terminal I can enter it with CTRL+SHIFT+U00A0. This seems to work: it prints as a space, but is not equal to ' '. I don't know if there are any difficulties using, for example, utf8 encoding in source files (which you'll probably need).

Jan

On 04/25/2011 03:28 PM, Duncan Murdoch wrote:
> On 25/04/2011 9:13 AM, Mark Heckmann wrote:
>> I use a function that inserts line breaks ("\n" as escape sequence)
>> according to some criterion when there are blanks in the string.
>> e.g. "some text \nand some more text".
>>
>> What I want now is another form of a blank, so my function will not
>> insert a 能n" at that point.
>> e.g. "some text\spaceand some more text"
>>
>> Here "\space" stands for some escape sequence for a blank, which is
>> what I am looking for.
>> So what I need is something that will appear as a blank when printed
>> but not in the string itself.
>
> I don't think R has anything like that built in. You'll need to
> attach a class to your vector of strings, and write a print method for
> it that does the substitution before printing.
>
> Duncan Murdoch
>
>> TIA
>>
>> Am 25.04.2011 um 15:05 schrieb Duncan Murdoch:
>>
>> > On 25/04/2011 9:01 AM, Mark Heckmann wrote:
>> >> Is there a blank space escape sequence in R, i.e. something like
>> \sp etc. to produce a blank space?
>> >
>> > You need to give some context. A blank in a character vector will
>> be printed as a blank, so you are probably talking about something
>> else, but what?
>> >
>> > Duncan Murdoch
>>
>> 末末末末末末末末末末末末末末末末末末末
>> 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. Received on Mon 25 Apr 2011 - 14:41:01 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:00: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