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
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
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt. Name: nicht verf?gbar URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110425/336a6b29/attachment.pl>
On Mon, 25 Apr 2011, 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.Is it possible to use \x20 or some similar way to evoke the hexadecimal ascii form of blank? That works in perl as does \040 for the octal form. Mike
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.
Possibly Parallel Threads
- using regular expressions to retrieve a digit-digit-dot structure from a string
- splitting a string into words preserving blanks (using regex)
- no partial matching of argument names after dots argument - why?
- Reordering the results from table(cut()) by break argument
- changing a list element's name during execution in lapply - possible?