Skip to content
Prev 67487 / 398506 Next

removing characters from a string

Martin Maechler wrote:
Part of the problem here is our help system.  gsub is documented within 
the grep topic, so when you look at the keyword==character topics, you 
don't see it explicitly.  (You do see "pattern matching and 
replacement", which should have been a hint.)  And if you were looking 
for "string handling" under the programming category, you're completely 
out of luck.

Another reason some people might see R's string handling as limited is 
that it is sometimes more cumbersome to manipulate strings in R than in 
other languages.  For example, I vaguely recall that there's a good 
reason why R doesn't use "+" to concatenate strings, but I can't 
remember what it is.  And sometimes I'd like to strip whitespace or pad 
things to a given width; I generally need to define my own functions to 
do that each time.  R is capable of concatenation, stripping and 
padding, but is sometimes a little obscure in how it does them.

Duncan Murdoch