[R] a naive question

Steve Lianoglou mailinglist.honeypot at gmail.com
Wed Aug 19 23:03:39 CEST 2009


Hi,

On Aug 19, 2009, at 4:59 PM, Bogdan Tanasa wrote:

> Hi, and my apologies for the following very naive question : I would  
> like to
> read a column of numbers in R and plot a histogram.
>
> eg :
>
> x<-read.table("txSTART");
> y<-as.numeric(x);
>
> and I do obtain the error : Error: (list) object cannot be coerced  
> to type
> 'double'. Please could you let me know the way to fix it.

Yeah, you can't do that. What does x look like? Can you show us the  
result of:

R> head(x)

Assuming it's just a single column, you can access the numbers in the  
first column, like so

R> x[,1]

You can use that to plot a histogram of the numbers in the first column:

R> plot(hist(x[,1]))

-steve

--
Steve Lianoglou
Graduate Student: Computational Systems Biology
   |  Memorial Sloan-Kettering Cancer Center
   |  Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact




More information about the R-help mailing list