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