[R] Simple numeric "as.is" question

Uwe Ligges ligges at statistik.uni-dortmund.de
Mon Mar 15 17:10:37 CET 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.


So the elements of your data frame "x" are not numeric? read.table() 
auto-detects which variables are numeric or not, so there's something 
strange with your textfile, I guess.

   as.numeric(x$V1)
converts the first element in your data.frame x to numeric.

Uwe Ligges




More information about the R-help mailing list