is there a way to specify a blank in a string with special/escape characters? like: "and now a blank%%%%and text after the blank", where %%%% stand for the specification of the blank character TIA Mark ??????????????????????????????????????? Mark Heckmann Dipl. Wirt.-Ing. cand. Psych. Vorstra?e 93 B01 28359 Bremen Blog: www.markheckmann.de R-Blog: http://ryouready.wordpress.com
Duncan Murdoch
2010-Jul-20 13:26 UTC
[R] specify blank in a string with special characters
On 20/07/2010 9:00 AM, Mark Heckmann wrote:> is there a way to specify a blank in a string with special/escape > characters? > like: > > "and now a blank%%%%and text after the blank", > > where %%%% stand for the specification of the blank characterThe answer to your question is "yes", because you just did. But I think you have something more in mind: what part of R should recognize those special characters as blanks? Duncan Murdoch
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt. Name: nicht verf?gbar URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100720/d609a2f5/attachment.pl>
Duncan Murdoch
2010-Jul-20 14:43 UTC
[R] specify blank in a string with special characters
On 20/07/2010 10:09 AM, Mark Heckmann wrote:> will reformulate the question: > > I use strsplit() to split a string at the blanks. e.g. > > > strsplit("Split at blanks", " ") > [[1]] > [1] "Split" "at" "blanks" > > Now I would like to write something like a protected blank (like e.g. > in LaTex) into the string that does not get split > by strsplit() but still gives a blank when printed. E.g. > > > strsplit("Split%at blanks", " ") > [[1]] > [1] "Split at" "blanks" > > Is that possible? >Many character sets (latin1, Unicode, etc.) include some special "non-breaking spaces" which would work really well, if you can enter them. For example, you can enter these as \u{a0} or \u00a0, and then things will look just right: x <- "Split\u{a0}at blanks" x strsplit(x, " ") Duncan Murdoch> Am 20.07.2010 um 15:26 schrieb Duncan Murdoch: > > > On 20/07/2010 9:00 AM, Mark Heckmann wrote: > >> is there a way to specify a blank in a string with special/escape > >> characters? > >> like: > >> > >> "and now a blank%%%%and text after the blank", > >> > >> where %%%% stand for the specification of the blank character > > > > The answer to your question is "yes", because you just did. But I > > think you have something more in mind: what part of R should > > recognize those special characters as blanks? > > > > Duncan Murdoch > > ??????????????????????????????????????? > Mark Heckmann > Dipl. Wirt.-Ing. cand. Psych. > Vorstra?e 93 B01 > 28359 Bremen > 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. >
Hi, you can define delimiters strsplit("Split%at blanks", " |%") ----- A R learner. -- View this message in context: http://r.789695.n4.nabble.com/specify-blank-in-a-string-with-special-characters-tp2295453p2295639.html Sent from the R help mailing list archive at Nabble.com.