Re: [R] Differentiate alphanumeric vs numeric strings

2008-04-25 Thread Farrel Buchinsky
This is fantastic. As a future note to myself and to others who may stumble upon this: further documentation for all one's heart could desire is in the base help system at. Regular Expressions as used in R - regexp Pattern Matching and Replacement - grep Split the Elements of a Character Vector

Re: [R] Differentiate alphanumeric vs numeric strings

2008-04-24 Thread Gabor Grothendieck
This has the disadvantage of producing a warning when it finds non-numerics and also there are situations like 1E1 which it will regard as numeric so using a regexp is probably preferred but it is simple: !is.na(as.numeric(x)) On Thu, Apr 24, 2008 at 10:39 PM, Farrel Buchinsky <[EMAIL PROTECTED]

Re: [R] Differentiate alphanumeric vs numeric strings

2008-04-24 Thread jim holtman
The following will return the indices or the values of character strings that are all numeric: > x <- c("12345", "123AS23", "A123", "398457") > grep("^[[:digit:]]*$", x) # index [1] 1 4 > grep("^[[:digit:]]*$", x, value=TRUE) # values [1] "12345" "398457" > On Thu, Apr 24, 2008 at 10:39 PM

[R] Differentiate alphanumeric vs numeric strings

2008-04-24 Thread Farrel Buchinsky
I have a bunch of tables in a Microsoft Access database. An updated database is sent to me every week containing a new table. I know that is inefficient and weird but welcome to my life. I want to read the tables whose names are something such as "040207" but not the ones that have alphanumeric nam