[R] Histogram

Andrew Robinson andrewr at uidaho.edu
Wed Jan 5 01:24:27 CET 2005


x is not a numeric vector, so R doesn't know how to take a histogram.
Here are your clues:

> class(x)
> [1] "data.frame"
> is.numeric(x)
> [1] FALSE

so, try

names(x)

I speculate that LOGT is contained in the dataframe x.  If so, try

hist(x$LOGT)

I hope that this helps.

Andrew


On Tue, Jan 04, 2005 at 03:37:16PM -0800, duraikannan sundaramoorthi wrote:
> I have data on a single variable LOGT. It has about
> 300,000 observations. I am trying to make a Histogram
> out of this data set. Following is my effort. Could
> anyone help me to solve this error.
> 
> 
> > hist(x)
> Error in hist.default(x) : `x' must be numeric
> > class(x)
> [1] "data.frame"
> > is.object(x)
> [1] TRUE
> > is.vector(x)
> [1] FALSE
> > is.numeric(x)
> [1] FALSE
> > is.factor(x)
> [1] FALSE
> 
> note:plot(x) works okay
> 
> durai
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
Andrew Robinson                      Ph: 208 885 7115
Department of Forest Resources       Fa: 208 885 6226
University of Idaho                  E : andrewr at uidaho.edu
PO Box 441133                        W : http://www.uidaho.edu/~andrewr
Moscow ID 83843                      Or: http://www.biometrics.uidaho.edu
No statement above necessarily represents my employer's opinion.




More information about the R-help mailing list