Re: R-histogram error: 'x' must be numeric



D J <dingjia@xxxxxxxxx> wrote:

score<- read.csv('file.csv', header = FALSE,sep = ",")
hist(score, main = "score")

it gives error msg:
Error in hist.default("score", main = "score") :
'x' must be numeric

read.csv returns a data frame - i.e. a table. Even if it only has one
column it is still a data frame. What you want is this:

hist(score[,1])

Alternatively, you can use scan() to read the file into a vector.

cu
Philipp

--
Dr. Philipp Pagel Tel. +49-8161-71 2131
Dept. of Genome Oriented Bioinformatics Fax. +49-8161-71 2186
Technical University of Munich
http://mips.gsf.de/staff/pagel
.



Relevant Pages

  • Re: Finding a tuple in a tuple
    ... Another way to go instead of using sets, although probably less elegant: ... Dept. of Genome Oriented Bioinformatics Fax. +49-8161-71 2186 ... Technical University of Munich ...
    (comp.lang.python)
  • Re: a=b change b a==b true??
    ... I assume that I am missing a fundamental ... Dept. of Genome Oriented Bioinformatics Fax. +49-8161-71 2186 ... Technical University of Munich ...
    (comp.lang.python)