[R] test if elements of a character vector contain letters
Liviu Andronic
landronimirc at gmail.com
Tue Aug 7 11:28:47 CEST 2012
On Mon, Aug 6, 2012 at 7:35 PM, Marc Schwartz <marc_schwartz at me.com> wrote:
> is.letter <- function(x) grepl("[[:alpha:]]", x)
> is.number <- function(x) grepl("[[:digit:]]", x)
>
Quick follow-up question.
I'm always reluctant to create functions that would resemble the
method of a function (here, is() ), but would in fact not be a genuine
method. So would there be any incompatibility between is() and
is.letter(), given that the latter is not a method of the former?
Is it good (or acceptable) practice to define is.letter() as above?
Would is_letter() be better?
Regards
Liviu
More information about the R-help
mailing list