Skip to content
Prev 201546 / 398506 Next

Eliminating 'Unprintable ASCII' characters

I think you mean the control characters: there are other unprintable 
characters (del for example).  They are the character range 
[\001-\037].  E.g.
[1]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
[13]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
[25]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE FALSE FALSE FALSE FALSE FALSE
[37] FALSE FALSE FALSE FALSE

If you want to include del, use "[\001-\037\177]".  I have omitted nul 
(\000) which cannot occur in R character strings.

You didn't give us the sessionInfo() output the posting guide asked 
you for, so I am presuming you are not doing this in an unusual 
locale: I wouldn't trust the regexp code in one of the stateful 
locales used for Japanese.
On Wed, 25 Nov 2009, Steven Kang wrote: