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:


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


Dr. Philipp Pagel Tel. +49-8161-71 2131
Dept. of Genome Oriented Bioinformatics Fax. +49-8161-71 2186
Technical University of Munich