[R] remove Punctuation characters

Christos Hatzis christos at silicoinsights.com
Tue May 9 18:00:42 CEST 2006


gsub('[[:punct:]]', '', str)


-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Filipe Almeida
Sent: Tuesday, May 09, 2006 11:51 AM
To: r-help at stat.math.ethz.ch
Subject: [R] remove Punctuation characters


I want to remove all punctuation characters in a string. I was trying it use
a regular expressions but it doesn't work.
Here is a sample os what i want:

str <- 'ABD - remove de punct, and dot characters.'
str <- gsub('[:punct:]','',str)
"'ABD remove de punct and dot characters"

is there any function that do this kind of thing?

Thanks to all.

Filipe Almeida

	[[alternative HTML version deleted]]

R-help at stat.math.ethz.ch mailing list
PLEASE do read the posting guide!

More information about the R-help mailing list