Re: [R] Error in hist.default(A) : `x' must be numeric

From: Sundar Dorai-Raj <>
Date: Thu 07 Apr 2005 - 01:06:47 EST

Mag. Ferri Leberl wrote on 4/6/2005 9:57 AM:
> Dear everybody!
> I have load a list A of numbers and want a histogram to be drawn.
> on
> hist(Y)
> the Machine returns:
> Error in hist.default(A) : `x' must be numeric
> I found out, that the list is of type data.frame.
> Y<-as.numeric(Y)
> returns
> Error in as.double.default(A) : (list) object cannot be coerced to double
> What schould I do?
> Than you in advance!

The error messages cannot be more explicit. Y is a list (or data.frame). If you're trying to plot a histogram of a component in Y, use the "[[" or "$" extractors. E.g.

Y <- data.frame(x = rnorm(100))

I would suggest you learn to use ?str if you don't know what Y is.

--sundar mailing list PLEASE do read the posting guide! Received on Thu Apr 07 01:21:35 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:02 EST