[R] Unable to create histograms

John Fox jfox at mcmaster.ca
Thu Feb 17 00:26:58 CET 2005


Dear Radha,

On Wed, 16 Feb 2005 15:03:38 -0800 (PST)
 Radha Chebolu <rchebolu at yahoo.com> wrote:
> Hi,
> could someone pelase help me with this?
> 
> My data set's name is db1(say) and one of the
> variables is var1. I gave the command:
> hist(db1$var1). The values of Var1 are numbers.
> I got an error which says: 'x' must be numeric.
> Sometimes it works for other datasets and it's not
> working for this dataset.

If db1$var1 really were numeric, you wouldn't get this error. It's not
possible to tell what went wrong without more information.

> Also, does R let us import
> data from an excel spreadhsheet?
> 

Perhaps the simplest approach is to copy the cells from the spreadsheet
to the clipboard and read via read.table() or read.csv(). Remarkably,
this was addressed on the r-help list earlier today; see the thread
<https://stat.ethz.ch/pipermail/r-help/2005-February/064641.html> in
the list archive.

Other approaches are to output a csv file or to use the R-(D)COM
interface (see http://cran.r-project.org/other-software.html).

Regards,
 John

> Thanks,
> Radha
> 
> ______________________________________________
> 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

--------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/




More information about the R-help mailing list