On Tue, Aug 7, 2012 at 10:26 PM, Marc Schwartz <marc_schwa...@me.com> wrote:
> since there are alpha-numerics present, whereas the first option will:
>
>> grepl("[^[:alnum:]]", "ab%")
> [1] TRUE
>
>
> So, use the first option.
>
And I should start reading more carefully. The above works fine for me.

I ended up defining the following wrappers:
is_alpha <- function(x) {grepl("[[:alpha:]]", x)}  ##Alphabetic characters
is_digit <- function(x) {grepl("[[:digit:]]", x)}  ##Digits
is_alnum <- function(x) {grepl("[[:alnum:]]", x)}  ##Alphanumeric characters
is_punct <- function(x) {grepl("[[:punct:]]", x)}  ##Punctuation characters
is_notalnum <- function(x) {grepl("[^[:alnum:]]", x)}
##Non-Alphanumeric characters


Thanks again
Liviu

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

Reply via email to