[R] Quick Question about R

Chuck Cleland ccleland at optonline.net
Wed Jan 31 20:43:19 CET 2007

Konrad wrote:
> Hello,
> Is there a way to convert a character to a number with out getting a warning?  I have a vector that has both numbers and letters in it and I need to convert it to only numbers.  At the moment I'm using as.numeric but it is generating a warning when it converts a letter.  Is there another function out there that will do what I need or is there a way to turn off the warnings as I don't want the warning to be displayed to the end user?


options(warn = -1)

[1]  1 NA  2

options(warn = 0) # return to default

> Konrad Hammel
> Engineer
> Prilink LTD
> konrad.hammel at prilink.com
> 905.305.1096
> 	[[alternative HTML version deleted]]
> ______________________________________________
> R-help at stat.math.ethz.ch 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.

Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

More information about the R-help mailing list