[R] Simple numeric "as.is" question

Tom Blackwell tblackw at umich.edu
Mon Mar 15 17:04:08 CET 2004


Janet  -

Try  x2 <- as.numeric(as.character(x))
     hist(x2)

I'm not a Windows user, so I can't test this before sending.
It might solve the problem, might not.

(Flame !! :  This is just ONE MORE example of the difficulties
caused by the default behavior of  read.table()  to make things
into factors.  I sincerely wish the default were to preserve
character data as character.)

-  tom blackwell  -  u michigan medical school  -  ann arbor  -

On Mon, 15 Mar 2004, Janet Gannon wrote:

> I am reading a list of numbers from my clipboard, and have been
> successful, except I can't make a histogram as R doesn't recognize my
> variable as numeric.  I know I need to use "as.is", but the specifics
> escape me.
>
> I have used x<-read.table("clipboard", header=F) to import from a txt
> file.  How do make this numeric?  Thanks, J.
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list