[R] blank space escape sequence in R?
Duncan Murdoch
murdoch.duncan at gmail.com
Mon Apr 25 15:28:45 CEST 2011
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
>
>
>
>
>
More information about the R-help
mailing list