[R] importing data

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Oct 13 14:13:52 CEST 2004

On Wed, 13 Oct 2004, Andreas Betz wrote:

>  I am newcomer to R and I am loborating on this problem:
> How do I import data from a CD into R for further evaluation. 
> Using code "newgotcha <- read.table("e:\\asciiwin\\gotcha.dat") "
> returmns a list containing an additional column with indices. The
> command "plot (gotcha)" gives the expected plot. However, the line
> hist(gotcha) returns the message "Error in hist.default(newgotcha) : `x'
> must be numeric".

Um, you read `newgotcha' so what did you expect "plot (gotcha)" to do?

> How can I get the data in an accessible from  into R.

Please read `An Introduction to R' and note the difference between
read.table() and read.table(header=TRUE).

If that is not sufficient, please read the R Data Import/Export manual.

> Any suggestions are appreciated.
> Andreas
> Andreas Betz
> andreasbetz at earthlink.net
> 	[[alternative HTML version deleted]]
> ______________________________________________
> 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

Please do, and don't send HTML mail and do read the introductory

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-help mailing list