[R] using as.numeric() without generating warning message

2010-04-09 Thread Andrew Yee
I'm interested in testing whether or not a character string is numeric or not as follows: is.na(as.numeric('3')) # returns F is.na(as.numeric('A')) # I'd like this to return T without issuing a warning about NAs introduced by coercion. I guess you could suppress the warning with

Re: [R] using as.numeric() without generating warning message

2010-04-09 Thread Bert Gunter
[mailto:r-help-boun...@r-project.org] On Behalf Of Andrew Yee Sent: Friday, April 09, 2010 4:23 PM To: r-h...@stat.math.ethz.ch Subject: [R] using as.numeric() without generating warning message I'm interested in testing whether or not a character string is numeric or not as follows: is.na

Re: [R] using as.numeric() without generating warning message

2010-04-09 Thread Gabor Grothendieck
Try this: suppressWarnings(as.numeric(A)) On Fri, Apr 9, 2010 at 7:22 PM, Andrew Yee y...@post.harvard.edu wrote: I'm interested in testing whether or not a character string is numeric or not as follows: is.na(as.numeric('3')) # returns F is.na(as.numeric('A')) # I'd like this to return T

Re: [R] using as.numeric() without generating warning message

2010-04-09 Thread Bert Gunter
4:23 PM To: r-h...@stat.math.ethz.ch Subject: [R] using as.numeric() without generating warning message I'm interested in testing whether or not a character string is numeric or not as follows: is.na(as.numeric('3')) # returns F is.na(as.numeric('A')) # I'd like this to return T without issuing

Re: [R] using as.numeric() without generating warning message

2010-04-09 Thread Andrew Yee
Thanks for the tip! Andrew On Fri, Apr 9, 2010 at 8:04 PM, Gabor Grothendieck ggrothendi...@gmail.comwrote: Try this: suppressWarnings(as.numeric(A)) On Fri, Apr 9, 2010 at 7:22 PM, Andrew Yee y...@post.harvard.edu wrote: I'm interested in testing whether or not a character string is