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. Also, does R let us import data from an excel spreadhsheet? Thanks, Radha
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/
Are you sure it's numeric? Have you looked at the following: class(db1$var1) Do you mean "hist(db1$Var1)"? R is case sensitive. Importing data from an Excel spreadsheet was discussed earlier today on this list. My favorite, contributed by Gabor Grothendieck, was to select what you want in Excel, then "Copy", then use the following in R: read.delim2("clipboard", header = FALSE) Werner Wernersen then reported that it works the other way around as well: write.table(x, file("clipboard"), sep="\t") hope this helps. spencer graves Radha Chebolu 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. Also, does R let us import >data from an excel spreadhsheet? > >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 > >
Am Donnerstag, 17. Februar 2005 00:03 schrieb Radha Chebolu:> Hi,. Also, does R let us import> data from an excel spreadhsheet?Yes, there are very helpful examples in import/export data in your R documentation help.start() . AFAIR, there is also an example on how to import excel sheets to R Thomas