Bogdan: I believe your query demonstrates the hazards of jumping into R without first making an effort to read at least some of the supporting docs -- in this case, I think, "An Intro to R" would have sufficed.
R is not a video game nor even Excel. It is very powerful and quite sophisticated software for doing some pretty hairy stuff, implemented in its "raw" form as an interactive programming language (apologies if this is not the appropriate technical term). So, as I think you found out, it can make some pretty daunting demands on a beginner even for simple things. If you really need it's power and flexibility, once you've climbed the learning curve, it's an extraordinarily productive tool. If you are just a casual reader who doesn't need all that complex functionality, it's probably not worth the effort or frustration. Anyway, the answer to your question -- which may require you to read the docs to understand -- is that in R a "table" from read.table() is actually a data frame, which is also a special kind of list. As the error message says, as.numeric() cannot coerce recursive objects (which is what a list is) to simple numeric vectors. Bert Gunter Genentech Nonclinical Biostatisics -----Original Message----- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Bogdan Tanasa Sent: Wednesday, August 19, 2009 1:59 PM To: r-help@r-project.org Subject: [R] a naive question 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. thanks, bogdan <r-help@r-project.org> [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.