[R] a naive question

Bert Gunter gunter.berton at gene.com
Wed Aug 19 23:19:17 CEST 2009


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-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Bogdan Tanasa
Sent: Wednesday, August 19, 2009 1:59 PM
To: r-help at 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 :


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.


<r-help at r-project.org>

	[[alternative HTML version deleted]]

R-help at r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list