[R] Quick Question about R

Benilton Carvalho bcarvalh at jhsph.edu
Wed Jan 31 20:42:33 CET 2007


suppressWarnings(a <- as.numeric(c(1, 2, pi, "a", 9, "z")))

b

On Jan 31, 2007, at 2:35 PM, 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?
>
> 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.



More information about the R-help mailing list